create-t3-app icon indicating copy to clipboard operation
create-t3-app copied to clipboard

bug: Vercel build fails with "Error: The file "/vercel/path0/dist/routes-manifest.json" couldn't be found."

Open mauriciabad opened this issue 2 years ago • 5 comments

Provide environment information

 System:
    OS: Linux 6.0 Ubuntu 22.10 22.10 (Kinetic Kudu)
    CPU: (4) x64 Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
    Memory: 452.24 MB / 3.76 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
    npm: 9.1.2 - ~/.nvm/versions/node/v16.18.1/bin/npm
"ct3aMetadata": {
  "initVersion": "6.11.0"
}

Describe the bug

Following the installation and setting the db to mysql for planetscale makes the Vercel build fail with the following error:

Error: The file "/vercel/path0/dist/routes-manifest.json" couldn't be found. This is normally caused by a misconfiguration in your project.
Please check the following, and reach out to support if you cannot resolve the problem:
   1. If present, be sure your `build` script in "package.json" calls `next build`.  2. Navigate to your project's settings in the Vercel dashboard, and verify that the "Build Command" is not overridden, or that it calls `next build`.  3. Navigate to your project's settings in the Vercel dashboard, and verify that the "Output Directory" is not overridden. Note that `next export` does **not** require you change this setting, even if you customize the `next export` output directory.
 Learn More: https://err.sh/vercel/vercel/now-next-routes-manifest

To reproduce

  1. Follow the installation instructions, select all options (npm create t3-app@latest)
  2. Change the db to mysql in planetscale (and add the indexs and relation_mode option)
  3. Go to vercel, create the project
  4. Add the env variables a. (not sure if this causes the bug, but i put it just in case) Connect planetscale and vercel through their integration
  5. Trigger a build
  6. You get the error and the build fails

Additional information

Repo I'm working on: https://github.com/mauriciabad/dive-log

This is the literally only change I made to the generated code: Screenshot from 2022-12-04 04-56-33

Envoirement variables in Vercel

Screenshot from 2022-12-04 05-00-56

Build & Development Settings in Vercel

Screenshot from 2022-12-04 05-01-46

If I set the "Project Preset" to "Other", the build succeeds, but the page returns a 400 error: Screenshot from 2022-12-04 04-46-23

Full Vercel log

[04:51:46.913] Retrieving list of deployment files...
[04:51:47.178] Previous build cache not available
[04:51:49.882] Downloading 45 deployment files...
[04:51:50.412] Running "vercel build"
[04:51:50.926] Vercel CLI 28.6.0
[04:51:51.238] Running "install" command: `npm install`...
[04:52:05.834] 
[04:52:05.835] > [email protected] postinstall
[04:52:05.835] > prisma generate
[04:52:05.835] 
[04:52:07.054] Environment variables loaded from .env
[04:52:07.056] Prisma schema loaded from prisma/schema.prisma
[04:52:08.189] 
[04:52:08.190] ✔ Generated Prisma Client (4.7.1 | library) to ./node_modules/@prisma/client in 110ms
[04:52:08.190] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[04:52:08.190] ```
[04:52:08.190] import { PrismaClient } from '@prisma/client'
[04:52:08.190] const prisma = new PrismaClient()
[04:52:08.190] ```
[04:52:08.224] 
[04:52:08.224] added 317 packages, and audited 318 packages in 17s
[04:52:08.225] 
[04:52:08.225] 103 packages are looking for funding
[04:52:08.225]   run `npm fund` for details
[04:52:08.226] 
[04:52:08.226] found 0 vulnerabilities
[04:52:08.246] Detected Next.js version: 13.0.2
[04:52:08.248] Running "npm run build"
[04:52:08.559] 
[04:52:08.559] > [email protected] build
[04:52:08.559] > next build
[04:52:08.559] 
[04:52:08.858] info  - Loaded env from /vercel/path0/.env
[04:52:09.004] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[04:52:09.004] This information is used to shape Next.js' roadmap and prioritize features.
[04:52:09.004] 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:
[04:52:09.004] https://nextjs.org/telemetry
[04:52:09.004] 
[04:52:09.131] info  - Linting and checking validity of types...
[04:52:14.260] info  - Creating an optimized production build...
[04:52:20.975] info  - Compiled successfully
[04:52:20.975] info  - Collecting page data...
[04:52:25.837] info  - Generating static pages (0/6)
[04:52:25.923] info  - Generating static pages (1/6)
[04:52:25.938] info  - Generating static pages (2/6)
[04:52:25.950] info  - Generating static pages (4/6)
[04:52:25.970] info  - Generating static pages (6/6)
[04:52:25.982] info  - Finalizing page optimization...
[04:52:25.985] 
[04:52:26.004] Route (pages)                              Size     First Load JS
[04:52:26.006] ┌ ○ /                                      3.28 kB         110 kB
[04:52:26.006] ├   /_app                                  0 B             107 kB
[04:52:26.006] ├ ○ /404                                   181 B           107 kB
[04:52:26.006] ├ λ /api/auth/[...nextauth]                0 B             107 kB
[04:52:26.006] ├ λ /api/examples                          0 B             107 kB
[04:52:26.007] ├ λ /api/restricted                        0 B             107 kB
[04:52:26.007] └ λ /api/trpc/[trpc]                       0 B             107 kB
[04:52:26.007] + First Load JS shared by all              109 kB
[04:52:26.007]   ├ chunks/framework-3b5a00d5d7e8d93b.js   45.4 kB
[04:52:26.007]   ├ chunks/main-94d897311acc2837.js        27.1 kB
[04:52:26.007]   ├ chunks/pages/_app-4e49c70b8a55ab64.js  33.2 kB
[04:52:26.007]   ├ chunks/webpack-ee7e63bc15b31913.js     815 B
[04:52:26.007]   └ css/14a4ce6fb40c3e06.css               2.16 kB
[04:52:26.007] 
[04:52:26.008] λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
[04:52:26.008] ○  (Static)  automatically rendered as static HTML (uses no initial props)
[04:52:26.008] 
[04:52:26.389] Error: The file "/vercel/path0/dist/routes-manifest.json" couldn't be found. This is normally caused by a misconfiguration in your project.
[04:52:26.389] Please check the following, and reach out to support if you cannot resolve the problem:
[04:52:26.390]   1. If present, be sure your `build` script in "package.json" calls `next build`.  2. Navigate to your project's settings in the Vercel dashboard, and verify that the "Build Command" is not overridden, or that it calls `next build`.  3. Navigate to your project's settings in the Vercel dashboard, and verify that the "Output Directory" is not overridden. Note that `next export` does **not** require you change this setting, even if you customize the `next export` output directory.
[04:52:26.390] Learn More: https://err.sh/vercel/vercel/now-next-routes-manifest

mauriciabad avatar Dec 03 '22 21:12 mauriciabad

[04:52:26.390]   1. If present, be sure your `build` script in "package.json" calls `next build`.  2. Navigate to your project's settings in the Vercel dashboard, and verify that the "Build Command" is not overridden, or that it calls `next build`.  3. Navigate to your project's settings in the Vercel dashboard, and verify that the "Output Directory" is not overridden. Note that `next export` does **not** require you change this setting, even if you customize the `next export` output directory.

have you tried this? In my experience you don't need to override any of the build settings.

c-ehrlich avatar Dec 03 '22 21:12 c-ehrlich

I am getting the same error right now. Started a new T3 project today.

jabali2004 avatar Dec 03 '22 22:12 jabali2004

Could someone who is getting this error create a minimal reproduction (as close to stock create-t3-app as possible, and as few packages selected as possible) so we can try to figure out what is going on?

I just got a stock create-t3-app to deploy to Vercel successfully.

image

c-ehrlich avatar Dec 03 '22 23:12 c-ehrlich

After I deleted the vercel.json from the documentation it worked.

jabali2004 avatar Dec 04 '22 00:12 jabali2004

I fixed it by deleting the vercel.json file and removing the overrides.

It's weird that the problem is the vercel.json file. Maybe the commands in it are wrong, because in the overrides i had the same as in vercel.json, so maybe Vercel is using other ones.

mauriciabad avatar Dec 04 '22 04:12 mauriciabad

Mine is not working it stills says - Error: The file "/vercel/path0/.next/routes-manifest.json" couldn't be found. This is often caused by a misconfiguration in your project.

I have done all what you guys have suggested but still nothin g i am using pnpm + turbo for building the web

Kinfe123 avatar Jun 05 '23 06:06 Kinfe123

Check if you have modified distDir in next.config.js, if so you must also change it in the project configuration "Output Directory" in Vercel

frankalvarezdev avatar Jul 15 '23 02:07 frankalvarezdev

[04:52:26.390]   1. If present, be sure your `build` script in "package.json" calls `next build`.  2. Navigate to your project's settings in the Vercel dashboard, and verify that the "Build Command" is not overridden, or that it calls `next build`.  3. Navigate to your project's settings in the Vercel dashboard, and verify that the "Output Directory" is not overridden. Note that `next export` does **not** require you change this setting, even if you customize the `next export` output directory.

have you tried this? In my experience you don't need to override any of the build settings.

Thanks it helped!!

debsouryadatta avatar Mar 20 '24 11:03 debsouryadatta