Build errors when deploying Next.js app on vercel

I am trying to deploy my nextjs app on vercel. I have uploaded the repository and the necessary env variables. However whenever I attempt to deploy I have the error below:

Error fetching data: B [Error]: Dynamic server usage: no-store fetch procura-app-v1-1-1hkl.vercel.app/api/suppliers /dashboard/home/overview
    at /vercel/path0/.next/server/chunks/8948.js:2:8558
    at /vercel/path0/.next/server/chunks/8948.js:2:15891
    at a.with (/vercel/path0/.next/server/chunks/8948.js:1:8885)
    at c.with (/vercel/path0/.next/server/chunks/8948.js:1:3085)
    at c.startActiveSpan (/vercel/path0/.next/server/chunks/8948.js:1:18140)
    at a.startActiveSpan (/vercel/path0/.next/server/chunks/8948.js:1:18674)
    at /vercel/path0/.next/server/chunks/8948.js:2:15424
    at a.with (/vercel/path0/.next/server/chunks/8948.js:1:8885)
    at c.with (/vercel/path0/.next/server/chunks/8948.js:1:3085)

I don’t really know why this is happening but I have a feeling it may be because of the environment variables.

Deployment URL or Custom Domain: https://procura-app-v1-1-1hkl-git-main-procuras-projects-4a411bda.vercel.app/
Environment (local, preview, production): NEXT_PUBLIC_WEBSITE_URL, DATABASE_URL
Project Framework: Nextjs, Prisma, React, MongoDB
Build Settings:
  Framework Preset:
  Build Command (if not default):
  Output Directory (if not default):
  Install Command (if not default):
Node/Runtime Version:
Package Manager: npm
Relevant Packages:

Hi, @procuratechnologies! Welcome to the Vercel Community :smile:

Could you take a look at these docs? It looks related to your error!

Hello @procuratechnologies procuratechnologies

It looks like the deployment was deleted. Still, the error you are getting is “Error: Entity with the specified id does not exist in the system” might be coming from the CosmosDB.

I am checking the details internally and will get back to you soon. Let us know if the next build was successful and no more debugging is required.

Alright, just doing that at the moment

1 Like

Oh yeah, I deleted it, to retry. In fact let me retry again

So after doing some research, I realized that error was because I had cache: "no-store" in my getData function. I have commented that out but that makes me wonder why that is a problem during the build? It seems to work fine during development.

Do you have the cache: "no-store" wrapped in a try/catch block, within your getData function?

I came across an existing issue related to Next.js that you may be facing, and there’s a couple of workarounds mentioned in that issue thread that may help circumvent this behavior: cache: “no-store” option to make page SSR causes error on build.

1 Like

Yes it was in a try/catch block. Alright, I will check it out

1 Like

Sounds good, please report back to us :saluting_face:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.