Vercel build using turborepo is failing saying the env variable RESEND_API_KEY does not exist, but it does

All builds work fine locally, this build worked fine 24 days ago on Vercel until I updated depends. None of the deps updated touched resend. I don’t really know any other way to contact support for help.

{
  "$schema": "https://turbo.build/schema.json",
  "globalDependencies": ["**/.env.*local"],
  "tasks": {
    "build": {
      "inputs": ["$TURBO_DEFAULT$", ".env*"],
      "dependsOn": ["^build"],
      "outputs": [".next/**", "!.next/cache/**"]
    },
    "lint": {
      "dependsOn": ["^lint"]
    },
    "dev": {
      "cache": false,
      "persistent": true
    }
  }
}

This is what the turbo.json looks like and I have a packages/* as well as an apps/*. Running pnpm build locally works for all my projects.

If the update to dependencies included an update from turbo 1.x to 2, then strict environment mode is enabled by default. Declaring RESEND_API_KEY as a pass through env variable or switching back to using loose env mode should solve the problem.

I would suggest reading over the upgrade guide for 2.0 for an overview of all the breaking changes that happened.

1 Like

Yea it feels weird to have to specify an ENV that is used in one app/* in the build task that is used for EVERY app and package

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