vercel/remix

Deployment to Vercel causes a build panic when using manual route configuration #9431

Opened this issue · 1 comments

Reproduction

A public repo is available at peterje/remix-manual-route-config which was created by:

npx create-remix@latest --template vercel/vercel/examples/remix

Then updating vite.config.ts to use manual route configuration:

import { vitePlugin as remix } from "@remix-run/dev";
import { installGlobals } from "@remix-run/node";
import { defineConfig } from "vite";
import { vercelPreset } from '@vercel/remix/vite';
import tsconfigPaths from "vite-tsconfig-paths";

installGlobals();

export default defineConfig({
  plugins: [
    remix({
      ignoredRouteFiles: ["*"],
      routes(defineRoutes) {
        return defineRoutes((route) => {
          route("/", "routes/_index.tsx");
          route("/edge", "routes/edge.tsx");
        })
      },
      presets: [vercelPreset()]
    }
    ), tsconfigPaths()],
});

System Info

System:
    OS: macOS 14.2
    CPU: (8) arm64 Apple M3
    Memory: 340.77 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.1 - ~/.config/cache/fnm_multishells/64362_1715117864875/bin/node
    Yarn: 1.22.22 - ~/.config/cache/fnm_multishells/64362_1715117864875/bin/yarn
    npm: 10.5.0 - ~/.config/cache/fnm_multishells/64362_1715117864875/bin/npm
    pnpm: 9.0.5 - ~/.config/cache/fnm_multishells/64362_1715117864875/bin/pnpm
    bun: 1.1.4 - ~/.bun/bin/bun
  Browsers:
    Chrome: 124.0.6367.201
    Safari: 17.2
  npmPackages:
    @remix-run/dev: ^2.9.2 => 2.9.2
    @remix-run/eslint-config: ^2.9.2 => 2.9.2
    @remix-run/node: ^2.9.2 => 2.9.2
    @remix-run/react: ^2.9.2 => 2.9.2
    @remix-run/server-runtime: ^2.9.2 => 2.9.2
    vite: ^5.1.0 => 5.2.11

Used Package Manager

npm

Expected Behavior

After updating the Vite config, the Vercel deployment should be identical to the filesystem routing deployment.

Actual Behavior

The Vercel builder panics and fails the deployment with the unhelpful message:

An unexpected error happened when running this build. We have been notified of the problem. If you have any questions, please contact Vercel Support https://vercel.com/help.

Full logs:

[13:48:51.693] Running build in Washington, D.C., USA (East) – iad1
[13:48:51.886] Retrieving list of deployment files...
[13:48:52.440] Downloading 10 deployment files...
[13:48:55.774] Restored build cache
[13:48:55.862] Running "vercel build"
[13:48:56.314] Vercel CLI 34.1.10
[13:48:57.032] Warning: Detected "engines": { "node": ">=18.0.0" } in your `package.json` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version
[13:48:57.042] Installing dependencies...
[13:48:58.947] 
[13:48:58.948] up to date in 1s
[13:48:58.948] 
[13:48:58.948] 255 packages are looking for funding
[13:48:58.948]   run `npm fund` for details
[13:48:58.964] Detected `package-lock.json` generated by npm 7+
[13:48:58.965] Running "npm run build"
[13:48:59.213] 
[13:48:59.214] > build
[13:48:59.214] > remix vite:build
[13:48:59.215] 
[13:49:00.511] �[36mvite v5.2.11 �[32mbuilding for production...�[36m�[39m
[13:49:00.561] transforming...
[13:49:02.044] �[32m✓�[39m 86 modules transformed.
[13:49:02.169] rendering chunks...
[13:49:02.256] computing gzip size...
[13:49:02.379] �[2mbuild/client/�[22m�[32m.vite/manifest.json              �[39m�[1m�[2m  1.41 kB�[22m�[1m�[22m�[2m │ gzip:  0.35 kB�[22m
[13:49:02.383] �[2mbuild/client/�[22m�[2massets/�[22m�[36medge-asUEa6fM.js          �[39m�[1m�[2m  0.28 kB�[22m�[1m�[22m�[2m │ gzip:  0.24 kB�[22m
[13:49:02.388] �[2mbuild/client/�[22m�[2massets/�[22m�[36m_index-MPfO6gCD.js        �[39m�[1m�[2m  0.76 kB�[22m�[1m�[22m�[2m │ gzip:  0.39 kB�[22m
[13:49:02.388] �[2mbuild/client/�[22m�[2massets/�[22m�[36mroot-DtjcHO0x.js          �[39m�[1m�[2m  3.10 kB�[22m�[1m�[22m�[2m │ gzip:  1.59 kB�[22m
[13:49:02.390] �[2mbuild/client/�[22m�[2massets/�[22m�[36mjsx-runtime-56DGgGmo.js   �[39m�[1m�[2m  8.11 kB�[22m�[1m�[22m�[2m │ gzip:  3.05 kB�[22m
[13:49:02.391] �[2mbuild/client/�[22m�[2massets/�[22m�[36mentry.client-BDSkmrgt.js  �[39m�[1m�[2m 11.63 kB�[22m�[1m�[22m�[2m │ gzip:  4.09 kB�[22m
[13:49:02.391] �[2mbuild/client/�[22m�[2massets/�[22m�[36mcomponents-ULJOhd3c.js    �[39m�[1m�[2m224.04 kB�[22m�[1m�[22m�[2m │ gzip: 72.45 kB�[22m
[13:49:02.392] �[32m✓ built in 1.84s�[39m
[13:49:02.561] �[36mvite v5.2.11 �[32mbuilding SSR bundle for production...�[36m�[39m
[13:49:02.566] transforming...
[13:49:02.587] �[36mvite v5.2.11 �[32mbuilding SSR bundle for production...�[36m�[39m
[13:49:02.591] transforming...
[13:49:02.655] �[32m✓�[39m 5 modules transformed.
[13:49:02.688] rendering chunks...
[13:49:02.698] �[32m✓�[39m 5 modules transformed.
[13:49:02.703] rendering chunks...
[13:49:02.709] �[2mbuild/server/edge-eyJydW50aW1lIjoiZWRnZSJ9/�[22m�[32m.vite/manifest.json  �[39m�[1m�[2m0.15 kB�[22m�[1m�[22m
[13:49:02.709] �[2mbuild/server/edge-eyJydW50aW1lIjoiZWRnZSJ9/�[22m�[36mindex.js             �[39m�[1m�[2m3.74 kB�[22m�[1m�[22m
[13:49:02.711] �[2mbuild/server/nodejs-eyJydW50aW1lIjoibm9kZWpzIn0/�[22m�[32m.vite/manifest.json  �[39m�[1m�[2m0.15 kB�[22m�[1m�[22m
[13:49:02.711] �[2mbuild/server/nodejs-eyJydW50aW1lIjoibm9kZWpzIn0/�[22m�[36mindex.js             �[39m�[1m�[2m4.54 kB�[22m�[1m�[22m
[13:49:02.713] �[32m✓ built in 147ms�[39m
[13:49:02.713] �[32m✓ built in 123ms�[39m
[13:49:06.448] Build Completed in /vercel/output [9s]
[13:49:06.575] Deploying outputs...
[13:49:07.164] An unexpected error happened when running this build. We have been notified of the problem. If you have any questions, please contact Vercel Support https://vercel.com/help.
[13:49:07.264] Injected preview comments middleware, you can disable this in your project settings.
[13:49:08.840] 

Thank you for the reproduction. I will take a look into this soon.