Next.js Discord

Discord Forum

Prevent a Route from running when you prerender/Build an app

Unanswered
Ruby-crowned Kinglet posted this in #help-forum
Open in Discord
Ruby-crowned KingletOP
Hey Guys!

I am deploying an app i mad eonto vercel. I have this mass post route i made a cronjob out of that posts to my prisma database every night. However, each time i deploy the app, it takes like 20 minutes to deploy because it runs this request when i dont want it to. How can i make it not run when i deploy my apps on prerendering but still let this compile for my cronjob?

1 Reply

Ruby-crowned KingletOP
⨯ Static worker exited with code: null and signal: SIGTERM
⨯ Static worker exited with code: null and signal: SIGTERM
Build error occurred
Error: Static page generation for /api/shooting is still timing out after 3 attempts. See more info here https://nextjs.org/docs/messages/static-page-generation-timeout
at onRestart (/vercel/path0/node_modules/next/dist/build/index.js:293:27)
at /vercel/path0/node_modules/next/dist/lib/worker.js:95:40
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /vercel/path0/node_modules/next/dist/export/index.js:450:20
at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:154:20)
at async /vercel/path0/node_modules/next/dist/export/index.js:448:24
at async Promise.all (index 19)
at async exportAppImpl (/vercel/path0/node_modules/next/dist/export/index.js:440:21)
at async /vercel/path0/node_modules/next/dist/export/index.js:623:16
at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:154:20)
Error: Command "npm run build" exited with 1


it says this happens