Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Fatal Error #52578

Closed
1 task done
joacub opened this issue Jul 12, 2023 · 30 comments
Closed
1 task done

Production Fatal Error #52578

joacub opened this issue Jul 12, 2023 · 30 comments
Labels
bug Issue was opened via the bug report template. locked please add a complete reproduction The issue lacks information for further investigation

Comments

@joacub
Copy link

joacub commented Jul 12, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

at validateURL (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/app-render/validate-url.js:24:19)
    at renderToHTMLOrFlight (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/app-render/app-render.js:102:51)
    at NextNodeServer.renderHTMLImpl (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/next-server.js:694:20)
    at /app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/next-server.js:685:105
    at NextTracerImpl.trace (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/lib/trace/tracer.js:90:20)
    at NextNodeServer.renderHTML (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/next-server.js:685:41)
    at doRender (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/base-server.js:1059:37)
    at cacheEntry.responseCache.get.incrementalCache.incrementalCache (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/base-server.js:1197:34)
    at /app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/response-cache/index.js:99:42
    at ResponseCache.get (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/response-cache/index.js:149:11)
Error: Invalid request URL
    at validateURL (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/app-render/validate-url.js:24:19)
    at renderToHTMLOrFlight (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/app-render/app-render.js:102:51)
    at NextNodeServer.renderHTMLImpl (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/next-server.js:694:20)
    at /app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/next-server.js:685:105
    at NextTracerImpl.trace (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/lib/trace/tracer.js:90:20)
    at NextNodeServer.renderHTML (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/next-server.js:685:41)
    at doRender (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/base-server.js:1059:37)
    at cacheEntry.responseCache.get.incrementalCache.incrementalCache (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/base-server.js:1197:34)
    at /app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/response-cache/index.js:99:42
    at ResponseCache.get (/app/node_modules/.pnpm/next@13.4.10-canary.3_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0_sass@1.63.6/node_modules/next/dist/server/response-cache/index.js:149:11)

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

no response

To Reproduce

Just update to latest canary version you have broken this really badly

Describe the Bug

500 server error

Expected Behavior

no server error

Which browser are you using? (if relevant)

no response

How are you deploying your application? (if relevant)

no response

@joacub joacub added the bug Issue was opened via the bug report template. label Jul 12, 2023
@joacub joacub changed the title Production Cache Fatal Error Production Fatal Error Jul 12, 2023
@balazsorban44 balazsorban44 added the please add a complete reproduction The issue lacks information for further investigation label Jul 12, 2023
@github-actions
Copy link
Contributor

We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate.

Why was this issue marked with the please add a complete reproduction label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository (template for pages, template for App Router), but you can also use these templates: CodeSandbox: pages or CodeSandbox: App Router.

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue.

Please test your reproduction against the latest version of Next.js (next@canary) to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

What happens if I don't provide a sufficient minimal reproduction?

Issues with the please add a complete reproduction label that receives no meaningful activity (e.g. new comments with a reproduction link) are automatically closed and locked after 30 days.

If your issue has not been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the 👍 reaction on the topmost comment (please do not comment "I have the same issue" without reproduction steps). Then, we can sort issues by votes to prioritize.

I think my reproduction is good enough, why aren't you looking into it quicker?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

@joacub
Copy link
Author

joacub commented Jul 12, 2023

@balazsorban44 can not make a reproduction , this only happens in production in a certain point without notice, we dont know what is causing this, seems like there were a change in caches or something about bots conflicting with isr. bu i really dont know what is causing this, we just notice that when time pass, this happens to all the pages in the project.

@balazsorban44
Copy link
Member

Thanks, a reproduction would be very helpful. We need more information to investigate.

If you are confident this is a bug, you can try narrowing down which version is causing the issue by going through the canary releases at https://github.com/vercel/next.js/releases. This way we could pinpoint the exact PR/code change.

@joacub
Copy link
Author

joacub commented Jul 13, 2023

again failing, we have a production website failing again and again with no reason after working properly. is frustrating

image

@joacub
Copy link
Author

joacub commented Jul 13, 2023

Thanks, a reproduction would be very helpful. We need more information to investigate.

If you are confident this is a bug, you can try narrowing down which version is causing the issue by going through the canary releases at https://github.com/vercel/next.js/releases. This way we could pinpoint the exact PR/code change.

There were a pr about incremental cache that in almost sure is what is causing this error I will attach here

@joacub
Copy link
Author

joacub commented Jul 13, 2023

#52360
#51663

@joacub
Copy link
Author

joacub commented Jul 13, 2023

this is the code failing:

async function renderToHTMLOrFlight(req, res, pagePath, query, renderOpts) {
    const isFlight = req.headers[_approuterheaders.RSC.toLowerCase()] !== undefined;
    const pathname = (0, _validateurl.validateURL)(req.url);

there were a pr about changing the function that validates the url to rely on nodes validating url for performance reason, i dont see now the pr but i recall that.

as you can see you are expecting in a header an url that can be wrong and there is not catch of the error which is causing all website to crash

@xesrevinu
Copy link

xesrevinu commented Jul 14, 2023

I encountered the same problem while using wrk for stress testing.

wrk -t12 -c400 -d30s http://127.0.0.1:3000

next: 13.4.10 production node: 20.3.1

Error: Invalid request URL
    at validateURL (/workspace/node_modules/.pnpm/next@13.4.10_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/app-render/validate-url.js:24:19

@joacub
Copy link
Author

joacub commented Jul 15, 2023

I encountered the same problem while using wrk for stress testing. 13.4.10 production

wrk -t12 -c400 -d30s http://127.0.0.1:3000

Error: Invalid request URL
    at validateURL (/workspace/node_modules/.pnpm/next@13.4.10_@babel+core@7.22.5_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/app-render/validate-url.js:24:19

Do you manage to fix or workaround we are getting this issue all the time and customers are starting to yield😔

@joacub
Copy link
Author

joacub commented Jul 16, 2023

the error that fails the url is this:

image

@xesrevinu
Copy link

xesrevinu commented Jul 16, 2023

Hey @joacub What is your Node version? Can you currently reproduce the issue? Everything works fine when I revert back to node v18.16.0.

node 20.0.0 will have errors
node 20.1.0 works fine

@joacub
Copy link
Author

joacub commented Jul 16, 2023

Hey @joacub What is your Node version? Can you currently reproduce the issue? Everything works fine when I revert back to node v18.16.0.

node 20.0.0 will have errors node 20.1.0 works fine

I have latest node version 20.4

@a4lmamun
Copy link

a4lmamun commented Jul 16, 2023

I got same issue today 500 | Internal Server Error. Running on nextjs 13.4.10 with node v20.2.0.
image

@joacub
Copy link
Author

joacub commented Jul 16, 2023

@cyrillbolliger
Copy link

same issue here:

2023-07-17T08:27:28.910 app[683d023f792528] cdg [info] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] Error: Invalid request URL
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] at validateURL (/app/node_modules/next/dist/server/app-render/validate-url.js:24:19)
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] at renderToHTMLOrFlight (/app/node_modules/next/dist/server/app-render/app-render.js:120:51)
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] at A
ppPageRouteModule.render (/app/.next/server/chunks/674.js:7538:52)
2023Invalid request URL-07-17T08:27:28.915 app[683d023f792528] cdg [info] at doRender (/app/node_modules/next/dist/server/base-server.js:1068:40)
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] at cacheEntry.responseCache.get.incrementalCache.incrementalCache (/app/node_modules/next/dist/server/base-server.js:1215:34)
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] at /app/node_modules/next/dist/server/response-cache/index.js:99:42
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] at ResponseCache.get (/app/node_modules/next/dist/server/response-cache/index.js:149:11)
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] at NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/next/dist/server/base-server.js:1134:53)
2023-07-17T08:27:28.915 app[683d023f792528] cdg [info] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

node: v20.4.0
next: 13.4.10

also only happens in production.

any fixes / workarounds yet?

@sandrotanner
Copy link

#52353?

@joacub
Copy link
Author

joacub commented Jul 17, 2023

#52353?

That’s the one I was referencing before . That’s the change is braking everything

@joacub
Copy link
Author

joacub commented Jul 17, 2023

there is something wrong with this canParse function, in my case is failing a slash and it should not fail, so my guess is that next or something else is polifying the function and is not working properly, when using the canParse in a raw node with the same params, does not fail and works a expected, but in the next context fails at some point, or the slash is a special character or something, i dont really know.

@joacub
Copy link
Author

joacub commented Jul 17, 2023

this:

const test = URL.canParse('/ ', 'http://n');
console.log(test);

return true, but in next context sometimes return false which cause the function to return a exception

@joacub
Copy link
Author

joacub commented Jul 17, 2023

bug detected, it happened when you stress the node, then start yielding the false doing this will throw false at some point:

while (true) {
  const test = URL.canParse('/ ', 'http://n');
  console.log(test);
}

@joacub
Copy link
Author

joacub commented Jul 17, 2023

open a issue in nodejs:

nodejs/node#48816

@anonrig
Copy link
Contributor

anonrig commented Jul 17, 2023

I opened a fix for this in the Node repository. Hopefully, it can be included in the next LTS release - v18.17.0 - nodejs/node#48817

@joacub
Copy link
Author

joacub commented Jul 17, 2023

I opened a fix for this in the Node repository. Hopefully, it can be included in the next LTS release - v18.17.0 - nodejs/node#48817

this is happening also in the 20.4 version, the fix you submit is only for older versions ?

@joacub
Copy link
Author

joacub commented Jul 17, 2023

Are you a worker of nextjs ? the pr you sibmited to nextjs should be reverted untile this is fixed by node

@anonrig
Copy link
Contributor

anonrig commented Jul 17, 2023

I opened a fix for this in the Node repository. Hopefully, it can be included in the next LTS release - v18.17.0 - nodejs/node#48817

this is happening also in the 20.4 version, the fix you submit is only for older versions ?

The PR I've opened will be backported to Node 18 and 20 as well.

@anonrig
Copy link
Contributor

anonrig commented Jul 20, 2023

This issue does not exist in Node 18.17.0, or any LTS release. It was a false alarm.

@joacub
Copy link
Author

joacub commented Jul 20, 2023

This issue does not exist in Node 18.17.0, or any LTS release. It was a false alarm.

So when it is happening ? We tested and when stressed this is showing up

@anonrig
Copy link
Contributor

anonrig commented Jul 20, 2023

This particular code does work as expected as of Node v18.17.0 which is released 2 days ago. v20.5.0 which will be released today/tomorrow (ref: https://github.com/nodejs/node/releases/tag/v20.5.0), will also fix this in version 20.

while (true) {
  const test = URL.canParse('/ ', 'http://n');
  console.log(test);
}

@styfle
Copy link
Member

styfle commented Jul 25, 2023

Great! Sounds like its fixed upstream. Can we close this issue?

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked please add a complete reproduction The issue lacks information for further investigation
Projects
None yet
Development

No branches or pull requests

8 participants