remix: Error in vercel deploy: TypeError: Cannot read properties of undefined (reading 'v2_meta')

What version of Remix are you using?

1.6.7

Steps to Reproduce

clone repository by ssh: git clone git@github.com:Lucas-Eduardo-Goncalves/pac.app.git then add this repository to vercel, and try.

Expected Behavior

My site should work normally. On localhost I can’t find it works normally.

Actual Behavior

I find the error message: TypeError: Cannot read properties of undefined (reading ‘v2_meta’)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (3 by maintainers)

Most upvoted comments

Seem you are missing edit the remix config while you want to deploy to Vercel. In remix.config.js

/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
  serverBuildTarget: "vercel",
  // When running locally in development mode, we use the built in remix
  // server. This does not understand the vercel lambda module format,
  // so we default back to the standard build output.
  server: process.env.NODE_ENV === "development" ? undefined : "./server.js",
  ignoredRouteFiles: ["**/.*"],
  // appDirectory: "app",
  // assetsBuildDirectory: "public/build",
  // serverBuildPath: "api/index.js",
  // publicPath: "/build/",
};

Create new server.js file at your root folder (the same level of remix.config.js)

import { createRequestHandler } from "@remix-run/vercel";
import * as build from "@remix-run/dev/server-build";

export default createRequestHandler({ build, mode: process.env.NODE_ENV });

Can you add future: {} in your remix.config.js and see if the issue goes away?