fridge-cms / fridge_api.js

Fridge API client for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NEXTJS build error

ayazalavi opened this issue · comments

I am getting following error while trying to compile nextjs project. Any idea how this error is getting generated?


info  - Generating static pages (0/13)
--
23:37:09.181 | info  - Generating static pages (3/13)
23:37:09.201 | info  - Generating static pages (6/13)
23:37:09.241 | info  - Generating static pages (9/13)
23:37:09.711 |  
23:37:09.711 | Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
23:37:09.711 | Error: Fridge Error: content/homepage: 404 - Not Found
23:37:09.712 | at fridge (/vercel/path0/node_modules/fridge-next/dist/fridge.js:24:15)
23:37:09.712 | at processTicksAndRejections (node:internal/process/task_queues:96:5)
23:37:09.712 | at async getStaticProps (/vercel/path0/.next/server/pages/index.js:648:21)
23:37:09.712 | at async renderToHTML (/vercel/path0/node_modules/next/dist/server/render.js:442:20)
23:37:09.713 | at async /vercel/path0/node_modules/next/dist/export/worker.js:275:36
23:37:09.713 | at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:75:20)
23:37:09.713 |  
23:37:09.714 | > Build error occurred
23:37:09.714 | info  - Generating static pages (13/13)
23:37:09.715 | Error: Export encountered errors on following paths:
23:37:09.715 | /
23:37:09.716 | at /vercel/path0/node_modules/next/dist/export/index.js:499:19
23:37:09.716 | at runMicrotasks (<anonymous>)
23:37:09.716 | at processTicksAndRejections (node:internal/process/task_queues:96:5)
23:37:09.716 | at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:75:20)
23:37:09.716 | at async /vercel/path0/node_modules/next/dist/build/index.js:1015:17
23:37:09.717 | at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:75:20)
23:37:09.717 | at async /vercel/path0/node_modules/next/dist/build/index.js:889:13
23:37:09.717 | at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:75:20)
23:37:09.717 | at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:82:25)
23:37:09.764 | error Command failed with exit code 1.
23:37:09.764 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
23:37:09.787 | Error: Command "yarn run build" exited with 1




The Fridge api call to content/homepage is returning a 404 and throwing an error, failing the build. I would expect you are making the call in getStaticProps?

The Fridge api call to content/homepage is returning a 404 and throwing an error, failing the build. I would expect you are making the call in getStaticProps?

yes

It's possible you could be getting a 404 for an invalid auth token so double check you have your FRIDGE_TOKEN environment variable set. If that looks ok, next place to look would be making sure your Fridge API call is correct. There should be a content-type with a slug of homepage otherwise this call will always 404.