[Error]: No documents were returned

I just installed prismic on my nextjs project everything works fine if i launch it with pnpm run dev . but it fails if i try to build it for production:

P [Error]: No documents were returned
    at N.getFirst (/home/dandraghas/Documents/Projects/website/.next/server/chunks/770.js:1:6164)
    at async N.getSingle (/home/dandraghas/Documents/Projects/website/.next/server/chunks/770.js:1:7083)
    at async Module._ (/home/dandraghas/Documents/Projects/website/.next/server/chunks/140.js:1:6116)
    at async tR (/home/dandraghas/Documents/Projects/website/node_modules/.pnpm/next@14.1.3_react-dom@18.2.0_react@18.2.0_sass@1.72.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:227429)
    at async tP (/home/dandraghas/Documents/Projects/website/node_modules/.pnpm/next@14.1.3_react-dom@18.2.0_react@18.2.0_sass@1.72.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:227670)
    at async tT (/home/dandraghas/Documents/Projects/website/node_modules/.pnpm/next@14.1.3_react-dom@18.2.0_react@18.2.0_sass@1.72.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:2220)
    at async /home/dandraghas/Documents/Projects/website/node_modules/.pnpm/next@14.1.3_react-dom@18.2.0_react@18.2.0_sass@1.72.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:2632 {
  url: 'https://dandraghas.cdn.prismic.io/api/v2/documents/search?q=%5B%5Bat%28document.type%2C+%22metadata%22%29%5D%5D&pageSize=1&ref=ZgxrkhEAACIALnEb&routes=%5B%5D',
  response: undefined
}

when i go to that url, it returns:
{"page":1,"results_per_page":1,"results_size":0,"total_results_size":0,"total_pages":0,"next_page":null,"prev_page":null,"results":[],"version":"877bfdc","license":"All Rights Reserved"}

Here how i fetch it:

export async function generateMetadata(): Promise<Metadata> {
  const client = createClient();

  const metadata = await client.getSingle("metadata");

  return {
    title: metadata.data.title,
    description: metadata.data.description,
  };
}

I have published 'metadata'.

And yes it's single type.

the most weird things is why it works in dev but fails in prod

Hi @dandraghas ,

Welcome to the community :slight_smile:

Since your project is failing in prod (maybe vercel?) it's most likely the ongoing Next.js cache issue.

Thanks.