# \[Error\]: No documents were returned

**URL:** <https://community.prismic.io/t/error-no-documents-were-returned/15639>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [April 5, 2024, 12:11am UTC](https://community.prismic.io/t/error-no-documents-were-returned/15639 "2024-04-05T00:11:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dandraghas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/dandraghas/32/8127_2.png) [@dandraghas](https://community.prismic.io/u/dandraghas)\
**Post date:** [April 5, 2024, 12:11am UTC](https://community.prismic.io/t/error-no-documents-were-returned/15639/1 "2024-04-05T00:11:10Z")

</div>

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:

```auto
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:

```auto
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'.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/3/35bab3fd884e40e9d5d9a319b948fdacccab9dae.png)

And yes it's single type.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/d/d708610505f1d3354bdb07ba8d5e8dde7962b6d3.png)

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

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [April 5, 2024, 9:11am UTC](https://community.prismic.io/t/error-no-documents-were-returned/15639/2 "2024-04-05T09:11:13Z")

</div>

Hi @dandraghas ,

Welcome to the community 🙂

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

> [@Caching issue with Next.js App Router - Vercel Deployment](https://community.prismic.io/t/caching-issue-with-next-js-app-router-vercel-deployment/13834):
>
> Dear Prismic team I set up a new Next.js App Router project using your setup command npx @slicemachine/init@latest and walking trough your step by step setup guide. In previous versions, I never had issues deploying the site to Vercel and setting up Prismic Webhooks to trigger redeploys. With this new project it seems like there are some caching issues with Vercel: If I push a new commit to Github or if I edit content on Prismic, it triggers a new deploy correctly. Unfortunately those deplo…

Thanks.
