CF Worker throwing exception (500) even though the next request returns 200 #3024
Replies: 3 comments
-
It is a recurring thing of a first request being 500 exception and the second one being 200 that is not delivered but it is also not always happening as there are requests where there are constant 200s. |
Beta Was this translation helpful? Give feedback.
-
Temporary solution is to disable SSR for this page but it is not a solution as this way we loose all the SEO. I have also searched for additional resources about it and found this -> https://github.com/cloudflare/cloudflare-docs/pull/15014/files According to this PR in the CF docs, there are two possible causes of this issue:
Our Nuxt application does not modify any things related to nitro apart compressing the public assets. |
Beta Was this translation helpful? Give feedback.
-
For anyone else looking here in the future. We decided to move away from Cloudflare (this was one of several issues we had with this hosting) and we decided to change it to Vercel where this issue does not appear. |
Beta Was this translation helpful? Give feedback.
-
Environment
"nuxt": "3.14.1592",
nitropack "^2.10.4"
"engines": {
"node": "^18.20.5"
},
Nuxt Config:
Reproduction
https://www.monterail.com/
(I cannot create a reproduction repository as the issue seems to be related to the website under traffic - local project built with wrangler I cannot reproduce this issue).
This could maybe be useful https://zuplo.com/blog/2022/03/04/the-script-will-never-generate-a-response
Describe the bug
Monterail website is an SSR app deployed to Cloudflare Pages with Worker that uses Nitro. Recently, we started observing issues that Worker catches some unknown exception (you can actually experience it by going through the blog links and at certain point this bug will appear)
Once this exception is thrown by worker, it is cached by CF which means that even though this page can be correctly rendered, it will return the exception page. When trying to reload the page, it will hang there in pending state and eventually will return timeout in the browser caused by CF cancelled worker request.
When inspecing the Worker logs, I can see two requests to the same page:
The script will never generate a response.
Additional context
I thought about adding some configuration to the worker to add something like
ctx.passThroughOnException();
but I am not sure how to do that :(Logs
Beta Was this translation helpful? Give feedback.
All reactions