next-intl: Unable to deploy on Netlify with latest packages
Description
I created a test Repo to report the problem. I am not sure whether this is dependant on next-intl
or Netlify but I believe the new middleware created here certainly plays a role in this issue.
When I run this repo locally with netlify dev
all looks fine until I upgrade @netlify/plugin-nextjs
to “4.36.1”, at which point as soon as I run netlify dev
I start getting an error “middleware is not a function” with the following stack trace
TypeError: middleware is not a function
at handler (file:///PATH/TO/REPO/repo/sites/next-netlify-test/.netlify/edge-functions/next-dev/index.js:78:28)
at async FunctionChain.runFunction (https://64523ab4e7865600087fc3df--edge.netlify.app/bootstrap/function_chain.ts:390:22)
at async FunctionChain.run (https://64523ab4e7865600087fc3df--edge.netlify.app/bootstrap/function_chain.ts:310:20)
at async handleRequest (https://64523ab4e7865600087fc3df--edge.netlify.app/bootstrap/handler.ts:80:22)
at async Server.#respond (https://deno.land/std@0.170.0/http/server.ts:299:18)
If I downgrade it seems to work just fine. As I said above I am not sure where the problem lies here, but I thought it may be useful to report it here for your awareness as I believe there may be quite a few people using this library and deploying their app on Netlify. If you want to test this out you can fork my repo and test it locally, following the README.
If you need anything else from me, please let me know.
Mandatory reproduction URL (CodeSandbox or GitHub repository)
https://github.com/KrustyC/next-netlify-test
Reproduction description
Steps to reproduce:
.1 Install the modules
2. Run npm i @netlify/plugin-nextjs@latest next@latest
3. Run netlify dev
4. Access http://localhost:8888 on your browser
Expected behaviour
The page should load and the website should not break.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 22 (9 by maintainers)
Our fix https://github.com/netlify/next-runtime/pull/2116 was merged and released
oh I just seen your response 😅 so I guess we basically got to the same solution although with a slightly different code. ANyway I believe it is ok to close the issue
I see, I can try to modify my repo to avoid the usage of RSC and make sure it all works 😉
Thanks for collecting that information!
I don’t like it but if that’s how things are then I’ll also add code to our handling to handle both default and named export
@KrustyC I’ve just published
2.14.3-alpha.1
(non-RSC version) which should fix this. Can you maybe confirm that it does? I’ll also publish an RSC beta on top of that afterward, once this is inmain
.Sounds good! 🙌
I just checked the Netlify limitations:
This should not affect routing with the App Router,
next-intl
doesn’t rely on the mentioned properties onnextUrl
.