New: An invalid API response was returned

Hello, new to this game, and I seem to have a problem. Searching for the same error message in previous posts hasn't been all too helpful.

When doing a next build locally everything seems fine and all my pages pre-render. However, when I try to push our build through Netlify, I'm getting the above/below error on a number of pages, and the overall build fails and so nothing is pushed into production :frowning:

5:34:22 PM: Error occurred prerendering page "/en-gb/positive-relationships". Read more: https://nextjs.org/docs/messages/prerender-error
5:34:22 PM: Error: An invalid API response was returned
5:34:22 PM:     at Client.fetch (file:///opt/build/repo/node_modules/@prismicio/client/dist/index.js:578:11)
5:34:22 PM:     at processTicksAndRejections (internal/process/task_queues.js:95:5)
5:34:22 PM:     at async Client.getFirst (file:///opt/build/repo/node_modules/@prismicio/client/dist/index.js:282:20)
5:34:22 PM:     at async Client.getSingle (file:///opt/build/repo/node_modules/@prismicio/client/dist/index.js:336:12)
5:34:22 PM:     at async getStaticProps (/opt/build/repo/.next/server/pages/[...uid].js:93:24)
5:34:22 PM:     at async renderToHTML (/opt/build/repo/node_modules/next/dist/server/render.js:386:20)
5:34:22 PM:     at async /opt/build/repo/node_modules/next/dist/export/worker.js:304:36
5:34:22 PM:     at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)

I've updated to the latest slice-machine, but I wonder if I've got some misalignment between my local view of things vs Prismic's view of things.

CMS changes are flowing through fine, but the underlying build/structure cannot be changed (for example, I've successfully updated some underlying components and these worked fine, but now trying to change a CSP via code with little success due to the above).

Any help for a n00b greatly appreciated.

I have read Prerender Error | Next.js to no avail either :frowning:

I am also having this issue! Must have started very recently. I haven't really touched my repo either...

resolved by updating apiEndpoint in sm.json

1 Like

Updated to what? Just the below? Ah, will try.

  "_latest": "0.7.1",

Boo - no. Even more failures now :frowning:

Currently have sm.json as the following

{
  "_latest": "0.7.1",
  "apiEndpoint": "https://my-repo.prismic.io/api/v2",
  "storybook": "http://localhost:6006",
  "localSliceSimulatorURL": "http://localhost:3000/slice-simulator",
  "libraries": ["@/slices"]
}

Ah ... cdn

"apiEndpoint": "https://my-repo.cdn.prismic.io/api/v2",