Deployment error

I am trying to deploy a project that I created with Nextjs. The project builds easily locally with ‘npm run build’ or ‘npx next build’. But when I try to deploy to Vercel, I get the following error.

[23:09:55.268] Running build in Washington, D.C., USA (East) – iad1
[23:09:55.374] Cloning github.com/papeiron/Next.js-Ecommerce-App (Branch: main, Commit: 37ddc96)
[23:09:55.382] Skipping build cache, deployment was triggered without cache.
[23:09:55.764] Cloning completed: 389.029ms
[23:09:56.720] Running "vercel build"
[23:09:57.224] Vercel CLI 37.6.1
[23:09:57.649] Installing dependencies...
[23:10:01.234] npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
[23:10:01.765] npm warn deprecated npmlog@5.0.1: This package is no longer supported.
[23:10:02.289] npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
[23:10:02.750] npm warn deprecated gauge@3.0.2: This package is no longer supported.
[23:10:02.859] npm warn deprecated fstream@1.0.12: This package is no longer supported.
[23:10:04.299] npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported.
[23:10:04.388] npm warn deprecated @types/react-leaflet@3.0.0: This is a stub types definition. react-leaflet provides its own type definitions, so you do not need this installed.
[23:10:04.438] npm warn deprecated @types/exceljs@1.3.0: This is a stub types definition. exceljs provides its own type definitions, so you do not need this installed.
[23:10:05.342] npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
[23:10:05.343] npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
[23:10:05.569] npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
[23:10:05.719] npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
[23:10:05.797] npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
[23:10:05.797] npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
[23:10:05.944] npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
[23:10:18.750] 
[23:10:18.751] added 730 packages in 21s
[23:10:18.751] 
[23:10:18.751] 170 packages are looking for funding
[23:10:18.751]   run `npm fund` for details
[23:10:18.776] Detected Next.js version: 14.2.4
[23:10:18.776] Running "npx prisma generate && next build"
[23:10:19.748] Prisma schema loaded from prisma/schema.prisma
[23:10:20.573] 
[23:10:20.573] ✔ Generated Prisma Client (v5.20.0) to ./node_modules/@prisma/client in 326ms
[23:10:20.573] 
[23:10:20.573] Start by importing your Prisma Client (See: http://pris.ly/d/importing-client)
[23:10:20.573] 
[23:10:20.573] Tip: Want real-time updates to your database without manual polling? Discover how with Pulse: https://pris.ly/tip-0-pulse
[23:10:20.573] 
[23:10:21.826] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[23:10:21.826] This information is used to shape Next.js' roadmap and prioritize features.
[23:10:21.826] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[23:10:21.826] https://nextjs.org/telemetry
[23:10:21.826] 
[23:10:21.890]   ▲ Next.js 14.2.4
[23:10:21.891] 
[23:10:21.975]    Creating an optimized production build ...
[23:11:19.723]  ⚠ Compiled with warnings
[23:11:19.723] 
[23:11:19.723] ./node_modules/bcryptjs/dist/bcrypt.js
[23:11:19.723] A Node.js API is used (process.nextTick at line: 351) which is not supported in the Edge Runtime.
[23:11:19.723] Learn more: https://nextjs.org/docs/api-reference/edge-runtime
[23:11:19.723] 
[23:11:19.724] Import trace for requested module:
[23:11:19.724] ./node_modules/bcryptjs/dist/bcrypt.js
[23:11:19.724] ./src/config/auth.config.ts
[23:11:19.724] 
[23:11:19.724] ./node_modules/bcryptjs/dist/bcrypt.js
[23:11:19.724] A Node.js API is used (setImmediate at line: 352) which is not supported in the Edge Runtime.
[23:11:19.724] Learn more: https://nextjs.org/docs/api-reference/edge-runtime
[23:11:19.724] 
[23:11:19.724] Import trace for requested module:
[23:11:19.724] ./node_modules/bcryptjs/dist/bcrypt.js
[23:11:19.724] ./src/config/auth.config.ts
[23:11:19.724] 
[23:11:19.724] ./node_modules/bcryptjs/dist/bcrypt.js
[23:11:19.724] A Node.js API is used (setImmediate at line: 352) which is not supported in the Edge Runtime.
[23:11:19.724] Learn more: https://nextjs.org/docs/api-reference/edge-runtime
[23:11:19.724] 
[23:11:19.724] Import trace for requested module:
[23:11:19.724] ./node_modules/bcryptjs/dist/bcrypt.js
[23:11:19.724] ./src/config/auth.config.ts
[23:11:19.724] 
[23:11:19.724] ./node_modules/bcryptjs/dist/bcrypt.js
[23:11:19.724] A Node.js API is used (process.nextTick at line: 352) which is not supported in the Edge Runtime.
[23:11:19.724] Learn more: https://nextjs.org/docs/api-reference/edge-runtime
[23:11:19.724] 
[23:11:19.724] Import trace for requested module:
[23:11:19.724] ./node_modules/bcryptjs/dist/bcrypt.js
[23:11:19.724] ./src/config/auth.config.ts
[23:11:19.724] 
[23:11:44.673]  ✓ Compiled successfully
[23:11:44.674]    Linting and checking validity of types ...
[23:11:56.978]    Collecting page data ...
[23:11:58.221] Error: Couldn't fetch categories
[23:11:58.222]     at c (/vercel/path0/.next/server/chunks/1249.js:1:17744)
[23:11:58.222]     at async Object.l [as generateStaticParams] (/vercel/path0/.next/server/app/(customerFacing)/c/[category-slug]/page.js:1:6554)
[23:11:58.222]     at async buildParams (/vercel/path0/node_modules/next/dist/build/utils.js:1026:40)
[23:11:58.222]     at async /vercel/path0/node_modules/next/dist/build/utils.js:1043:33
[23:11:58.222]     at async /vercel/path0/node_modules/next/dist/build/utils.js:1177:114
[23:11:58.223]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:154:20)
[23:11:58.224] 
[23:11:58.224] > Build error occurred
[23:11:58.226] Error: Failed to collect page data for /c/[category-slug]
[23:11:58.226]     at /vercel/path0/node_modules/next/dist/build/utils.js:1268:15 {
[23:11:58.226]   type: 'Error'
[23:11:58.226] }
[23:11:58.250] Error: Command "npx prisma generate && next build" exited with 1
[23:11:59.199] 

Does your site connect to an external service, like a CMS, to build pages? It could be a missing environment variable

1 Like

I think I understand the problem. my database is hosted on AWS. so I need to give vercel access to the database, what is the best way to do this?

So i allowed all internet traffic for the database. Still getting the same error. Looks like Vercel is still unable to access the database.

For a database connection, environment variables are typically used to store credentials to allow the app to access the database. If it would help to see an example, there are multiple templates available here: vercel.com/templates

I have already added all env. variables. I don’t think there is a problem with this

Were you able to find a solution?

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