Failed to publish your Function. Got error: Error: Script startup exceeded CPU time limit

I’m using @cloudflare/next-on-pages to deploy my next.js application and i always get this error: “Failed to publish your Function. Got error: Error: Script startup exceeded CPU time limit.”

I didn’t find specific information for this error, how can i solve that?

This is a pretty common error with large scripts and those doing a lot of work outside of the request scope. It’s been reported before such as Failed to publish your Function. Got error: Error: Script startup exceeded CPU time limit. · Issue #54 · cloudflare/next-on-pages · GitHub. Like most other issues in that repo today, it’s not been addressed yet.

Honestly though, next-on-pages itself is in a state right now that I couldn’t personally recommend it due to lack of maintenance and support, and would encourage you to consider an alternate solution like Netlify or Vercel for your project if you need a quick resolution.

1 Like