The deployment to the workers is successful, but I get a 500 error when accessing it. (nextjs13)

I'm deploying Next.js13 using the wrangler command. Although the deployment succeeds, I'm encountering a 500 error. The Next.js page fetches from the API and server-side rendering(all pages) I'm not using App router It's puzzling because sometimes it works. Occasionally, after running yarn vercel build, I am prompted to execute vercel pull, and it succeeds afterward. However, this is also sporadic. I cannot determine a consistent way to reproduce the issue. How should I troubleshoot this? The static images are loading fine, so it seems the issue lies with the workers. Is there a way to check the logs to ensure the workers are operating correctly? This is my deployment procedure.
yarn
yarn run build
yarn vercel build
npx @cloudflare/next-on-pages@1
CLOUDFLARE_ACCOUNT_ID=xx CLOUDFLARE_API_TOKEN=yy wrangler pages publish .vercel/output/static --project-name=xx --branch=xx
yarn
yarn run build
yarn vercel build
npx @cloudflare/next-on-pages@1
CLOUDFLARE_ACCOUNT_ID=xx CLOUDFLARE_API_TOKEN=yy wrangler pages publish .vercel/output/static --project-name=xx --branch=xx
4 Replies
James
James•11mo ago
You should just be able to just run npx @cloudflare/next-on-pages@1 by itself. There is no need to run yarn run build or yarn vercel build before that. The next-on-pages CLI runs yarn vercel build itself, and the Vercel CLI runs yarn run build itself, so you seem to be running the same commands multiple times for no gain, and trying to run the vercel one before the next-on-pages cli has created a dummy project file for vercel to prevent it from trying to get you to pull from vercel. Anyway, are you able to share more information about the 500 error you're encountering?
negabar
negabar•11mo ago
The main document only shows as below and lacks information. Are there any logs for the workers?🥲
No description
negabar
negabar•11mo ago
@5927
James
James•11mo ago
You could try tailing the deployment with wrangler and view the logs when you send the request; npx wrangler pages deployment tail