Next.js developers face errors with middleware in production
10 posts since May 2023, all from GitHub.
“Link to the code that reproduces this issue https://github.com/Mephiztopheles/custom server middleware To Reproduce 1. Start the application ( npm run dev ) 2. Visit localhost:3000 in the browser 3. Click both links and get redirected 4. Stop the server and run the build ( npm…”
“Link to the code that reproduces this issue https://codesandbox.io/p/devbox/xenodochial link 5g95h4 To Reproduce 1. create A project, add component:”
“Verify canary release [X] I verified that the issue exists in the latest Next.js canary release Provide environment information Which area(s) of Next.js are affected? (leave empty if unsure) Middleware / Edge (API routes, runtime) Link to the code that reproduces this issue / To…”
Developers using Next.js are encountering issues where custom server middleware isn't functioning correctly in production environments, leading to redirection problems and unexpected behavior.
SOURCES (10)
“Link to the code that reproduces this issue https://github.com/Mephiztopheles/custom server middleware To Reproduce 1. Start the application ( npm run dev ) 2. Visit localhost:3000 in the browser 3. Click both links and get redirected 4. Stop the server and run the build ( npm…”
“Link to the code that reproduces this issue https://github.com/Dprof in tech/john achimugu To Reproduce Clone the repository on termux provisioned code server in your android device run npm install Npm run dev Screenshot 2024 07 17 04 54 27 645 com android chrome Current vs. Expected behavior It is supposed to just download the swc binary pack for android but instead it throws this error Provide environment information Which area(s) are affected? (Select all that apply) Developer Experience Whic”
“Link to the code that reproduces this issue https://codesandbox.io/p/devbox/xenodochial link 5g95h4 To Reproduce 1. create A project, add component: <Link prefeth={false} target=" selft" href="https://samedomain.com/path b" / 2. build and start production 3. debug in chrome with: window.addEventListener("beforeunload", function() { debugger; }, false) 4. click link 5. switch to Chrome network tab, you can see a incorrect prefetch before page refresh 6. if the href is come from B project, the tre”
“Link to the code that reproduces this issue https://github.com/creativeindustriesgroup/nextjs webpack middleware issue To Reproduce When importing certain packages into middleware, accessing any page which triggers the middleware will throw the error: ./node modules/farmhash modern/bin/bundler/farmhash modern bg.wasm Module parse failed: Unexpected character '' (1:0) The module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack. BREAKING CHANGE: Since we”
“Link to the code that reproduces this issue https://github.com/Cuboctaedro/nextjs notfound To Reproduce The app needs one env variable NEXT PUBLIC DOMAIN="http://localhost:3000/" on local or your domain if you deploy it. Run on localhost and you will see urls like: /this does not exist/page d showing the not found page as they should. Deploy on Vercel and the same ulrs do not show the not found page. Deploy on Netlify and the same urls show the not found page. Current vs. Expected behavior Curre”
“Link to the code that reproduces this issue https://github.com/eric burel/client array next repro To Reproduce 1. npm install && npm run dev 2. Open app Current vs. Expected behavior Current Will trigger error Error: Attempted to call includes() from the server but includes is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component. I've also tried serializing the object, doesn't work. Code samp”
“Link to the code that reproduces this issue https://github.com/scerelli/dot component bug next To Reproduce 1. Given a client component that exports multiple components accessible via dot notation, like the one you see in the repo attached, next fails to load the components. example: 4. Next fails to import it and throws an error Current vs. Expected behavior I expect it to load correctly Verify canary release [X] I verified that the issue exists in the latest Next.js canary release Provide envi”
“Link to the code that reproduces this issue https://codesandbox.io/p/sandbox/reverent bird n25ps5 To Reproduce 1. Open the link above. 2. Look at the log in the "Start Dev Server" window. 3. Open the Debugger window in the right browser and look at the logs there. Current vs. Expected behavior 1 The log ReferenceError: window is not defined is caused by the client component GlobalProvider executing on the server side. This is evidenced by the log GlobalProvider: null | make this module to be ren”
“Link to the code that reproduces this issue https://github.com/duydang2311/module imported multiple times issue reproduction To Reproduce 1. Start the application in development (next dev). 2. Connect to http://localhost:3000. Current vs. Expected behavior There are instrumentation.ts (NodeJS runtime) and page.tsx (runs on server) importing the same service.ts file. Current behavior The server prints "service.ts was imported" twice. This behaviour, in my original code, causes my service configur”
“Verify canary release [X] I verified that the issue exists in the latest Next.js canary release Provide environment information Which area(s) of Next.js are affected? (leave empty if unsure) Middleware / Edge (API routes, runtime) Link to the code that reproduces this issue / To Reproduce 1. Set up nginx and run with config: 2. Add middleware.js file inside /src 3. Add custom server inside /src : 4. Set up script run custom server: 5. run nginx proxy in local machine 6. run npm run build 7. run”
