I’m using NextJS middleware. Removing the middleware allows us to reach the site again. However the images all fail to load. I believe that this is due to the fact that we’re using NEXT_FORCE_EDGE_IMAGES which is running edge functions for image optimization.
We’re really sorry this didn’t work for you, we were dealing with a small issue in our pipeline that impacted a small amount of sites using this feature. The good news is that this issue is solved now.
It should be possible to use NEXT_FORCE_EDGE_IMAGES again now. I hope you’ll encounter no further issues, but feel free to let us know if you do. And thank you for your detailed question!
This happens very frequently for Edge functions on NextJs built on Netlify. I cannot figure out why. We had to just refactor and remove all our edge functions (still a few left), and remove middleware to get our site to function reliably. A bit disappointing because Edge functions are amazing for various reasons. But, NextJs Edge functions just don’t function reliably on Netlify for some reason. I do not think Deno was a good choice here for Netlify. If they host NextJs website that got to use the same platform as Vercel, Cloudflare V8 some other V8 engine, all of which are well out of beta and function very reliably. What we will probably due, since Netlify is actually a much better hosting platform than Vercel in other respects is to just use Cloudflare Workers for Edge and call the cloudflare workers within the netlify app. You can build your own type of middleware basically by doing that.
I don’t think you will have much problems if you just run the serverless functions on Cloudflare Workers (v8) directly or even just run them directly on Netlify Edge (still in beta), as opposed to in the NextJs app. The serverless functions on these hosting platforms, like Netlify and Vercel, are just built on top of some other platform, which you can use directly on your own. The downside is that you separate out the functions from the existing app, so you need to manage 2 repos basically. On the upside, though, you have better scalability and reliability. It’s a tough decision…Also, i think it’s critical to not put everything on the edge. Really only need it for parts of the application that need an immediate response. Otherwise, a short delay for better reliability is not that big of deal…
Sure you could run the edge functions somewhere else, however that’s not really an option for us at the moment since our dev team is incredibly small and we want to keep the complexity of our stack as simple as possible.
Worth noting is that Netlify edge functions are still in beta, so you have to expect some issues from time to time. However a complete site outage like in our case shouldn’t happen. Not considering the netlify edge functions I’d argue that Netlify is incredibly scalable as well as reliable.
Agree 100%. That’s why I stick with them. As for dev team, I am a team of 1, and I find working on edge functions elsewhere is much easier. You don’t have to worry about deploying the entire site when working on a serverless function. If you locate your functions in the same deploy as the app, you need to rebuild the entire site to get the new functions to deploy. It’s just the biggest pain imaginable and you risk errors. If you are doing it on another platform, you don’t need to worry about this. Much less room for errors.