Update: Enhanced Next.js Hybrid support in Static Web Apps #1066
Replies: 27 comments 79 replies
-
Unfortunately, CORS on nextjs still doesn’t work, I need my function to support some device installed app’s API calls, in which the originators are local hosts. I have tried #588 (comment), and it still does not work. My app on Vercel would work though, so I don’t think that’s related to my server’s config. |
Beta Was this translation helpful? Give feedback.
-
@Reshmi-Sriram We have tested the new features on our next.js application deploy and they work great!
One thing to take into account: The application insights was however not very informative about why the internal server error occured (probably because the function itself was not started at all). |
Beta Was this translation helpful? Give feedback.
-
How can I debug this? I am testing deploying as
I suspect my |
Beta Was this translation helpful? Give feedback.
-
We would like to move our Vercel deployments to Azure SWA, however I'm having issues with our Next.js app not seeing the environment variables. I've added them to the Configuration → Application Settings as well as in the workflows YAML:
Any suggestions? |
Beta Was this translation helpful? Give feedback.
-
Is anyone also experiencing this for next js? I see that the staticwebapp.config.json is not working. And it seems to me that Azure is intercepting the OPTIONS method, just returning a date which is not a valid POST preflight |
Beta Was this translation helpful? Give feedback.
-
Has there been any progress wrt. cold starts @Reshmi-Sriram? We have a small API backend on our NextJS-site hosted on SWA, and the site consistently loads slow if we haven't had any visitors in a while. I've understood that this is because of the cold start on the function? Is there some way for us to use a different App Service plan or configure it in any way to avoid cold starts? |
Beta Was this translation helpful? Give feedback.
-
Hey folks! We're continuing to work to improve our support for NextJS, and we're focusing on reducing cold starts and increasing app size limits. Just wanted to provide an update indicating that we are actively working on this. Stay tuned for more updates, we'll be updating you all in this thread/discussions regarding updates to NextJS |
Beta Was this translation helpful? Give feedback.
-
How do I get a turborepo monorepo w/ nextjs to work with this deployment? It's completely broken.
|
Beta Was this translation helpful? Give feedback.
-
Hello, Does this include support for the new |
Beta Was this translation helpful? Give feedback.
-
Can someone explain how NextJS support works in SWA exactly? Does it use Azure Functions? If so, do those only run in one region, so you lose the benefit of the static app being served from the closest CDN mirror? Thank you. |
Beta Was this translation helpful? Give feedback.
-
@Reshmi-Sriram - Are there any instructions on manually deploying a NextJS App in standalone mode? I have to use SWA CLI for deployment (can't use Github/Azure DevOps). The project was built successfully and I can see a "standalone" folder in the output directory. When I try to deploy the code from that directory, I get a message saying |
Beta Was this translation helpful? Give feedback.
-
We're currently using SWA in hybrid mode for our Next.js website and we're very excited that this feature is coming to Azure. However, we're running into some issues where sometimes the the We've been able to temporarily sidestep this by disabling client side navigation, but of course we're interested in a real fix. Here's some more background information on the website:
I've tried deploying the website to Vercel, Netlify and starting the build locally and that all works fine. Looking forward to any kind of help on this, many thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
Hi all, sorry if my question has been already asked but I can't find anything about this particular subject. |
Beta Was this translation helpful? Give feedback.
-
We are eager to try nextjs deployed on swa. We could not get our application working. Appreciate any help on this Error message in browser:
Error messages in AppInsights: Screenshots below. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I am trying to deploy a Nextjs hybrid app with the following characteristics:
I found this issue on the Next.js repository regarding standalone mode and the fact that neither the static nor the public folder are correctly copied to the standalone folder. vercel/next.js#50931 I was wondering if there is any action underneath that you are taking in order to add those two folders? I added a corresponding Github issue where I explain the other steps I have taken: #1244 Hope I provided enough details otherwise don't hesitate to follow up Cheers |
Beta Was this translation helpful? Give feedback.
-
I was able to get dynamic routing working on Static Web Apps by using the fallback rewrites technique. Add a rewrite rule to send all routes to /index.html: // next.config.js
trailingSlash: true,
reactStrictMode: true,
async rewrites() {
return {
fallback: [
{
source: '/:path*',
destination: '/index.html'
}
]
}
} Next.js will take care of routing to the correct page on the client-side. This allows routes like /blog/post-1 to be handled correctly. The fallback rewrite is important because Static Web Apps requires returning index.html for unknown routes. Next.js can then handle routing on the client-side. |
Beta Was this translation helpful? Give feedback.
-
I have an issue with SWA where the build logs says that the build was successfull but i keep getting 502 errors. I have a NextJS monorepo setup with NX and here is the output generated with the standalone feature. The generated output is different from the standard NextJS output. |
Beta Was this translation helpful? Give feedback.
-
Hello :) Would be happy to get some feedback from the team if the issue is known and maybe if there is a plan to fix it? :) |
Beta Was this translation helpful? Give feedback.
-
Update, at this time, hybrid Next.js support is still in preview and versions of Next 13 and above aren't fully supported with hybrid rendering. These can still be deployed statically. We're working on infrastructural changes to enable us to GA Next.js and support Next 13 in the coming months. |
Beta Was this translation helpful? Give feedback.
-
In case anyone has my same issue: GitHub Action was successful, 502 error on prod, after a LOT of debugging, I just had to remove |
Beta Was this translation helpful? Give feedback.
-
Hello @Reshmi-Sriram, do you have any news about features not included in preview. |
Beta Was this translation helpful? Give feedback.
-
We've rolled out improvements to our Next.js support which bring a handful of improvements, from support for Next.js 14 (& 13) along with app directory/React Server Components. I'll be closing this thread, please share your feedback and let's continue the discussion in the newest announcement: #1428 |
Beta Was this translation helpful? Give feedback.
-
Hi :)
If Azure Static Web Apps are capable of separate deployment of static and dynamic content, is it still required to update build command as described in documentation Deploy hybrid Next.js I guess it is not anymore needed and we can benefit from the smaller |
Beta Was this translation helpful? Give feedback.
-
Hi all,
March 22nd is the date of the first deployment of ours after the improvements of march 7th so I guess it's the day my app switched to the new implementation, therefore I think that my configuration is not 100% compatible with the new implementation. |
Beta Was this translation helpful? Give feedback.
-
backend call failure error still continues. unfortunately it's at least 3 times a day. any solutions? |
Beta Was this translation helpful? Give feedback.
-
Hello all!
Static Web Apps recently enhanced the support for Next.js Hybrid rendering. It now has these additional feature supports:
.next/standalone
which can then be deployed on its own without installingnode_modules
. In order to enable this support, you need to addoutput:"standalone"
in yournext.config.js
.public
and.next/static
folders during build time will be now handled and cached separately.NOTE: All these changes will reflect in your Next.js SSR apps only once you redeploy the app.
Kindly let us know how the enhanced experience is and drop more suggestions on things we should work towards for GA in the discussion thread here or the thread below!
Previous announcement thread: #921
Happy Coding!❤️
Beta Was this translation helpful? Give feedback.
All reactions