Debugging Script startup exceeded CPU time limit.
Hi, I'm using remix on cloudflare pages, when I try deploying I get -
Error: Failed to publish your Function. Got error: Error: Script startup exceeded CPU time limit.
Seems like a common issue with pages and workers, but I haven't found a good way to debug this other than making heavy imports async. Its not clear what might be the heavy import in my application
since my server bundle is 163K, any pointers on how I can debug this further? Is there a way to investigate startup time locally.
I'm using note compatibility for remix-auth-totp, but nothing else that happens in global context. I'm also using R2, D1, and KV.4 Replies
Maybe this is the problem, while
build/server/index.js
is 163K. When I run npm start
, the worker files are lot bigger. -
I remove some packages, brought it down to < 1MB gzipped. And now I see Error: Failed to publish your Function. Got error: Unknown internal error occurred.
Hi @squareclamp
Were you able to fix this issue? I am facing similar problems when trying to move my Pages project to vite. My project deploys without any issues using the old build system, but the vite project keeps giving me the following error:
Following is my vite config:
Any hints on how you were able to get around this issue? Thanks.
Try reducing your bundle size.
You can use the following command to see your bundle size. -
npx wrangler deploy .wrangler/bundle-analysis/index.js --dry-run --name foo --minify
Cool, will try that. Thanks