Das Fehlerprotokoll zeigt deutlich, dass die Umgebungsvariable DATABASE_URL fehlt, obwohl ich sie in meinen lokalen .env-Dateien definiert und die Variable auch zu meinen Vercel-Projekteinstellungen hinzugefügt habe.
Das Fehlerprotokoll von Vercel
Code: Select all
@repo/db:build:
@repo/db:build: > @repo/db@ build /vercel/path0/packages/db
@repo/db:build: > prisma generate && tsc
@repo/db:build:
@repo/db:db:generate: [[email protected]] injecting env (0) from .env.example -- tip: ⚙️ override existing env vars with { override: true }
@repo/db:db:generate: Failed to load config file "/vercel/path0/packages/db" as a TypeScript/JavaScript module. Error: PrismaConfigEnvError: Missing required [url=viewtopic.php?t=25360]environment[/url] variable: DATABASE_URL
@repo/db:db:generate: ELIFECYCLE Command failed with exit code 1.
@repo/db:db:generate: ERROR: command finished with error: command (/vercel/path0/packages/db) /pnpm10/node_modules/.bin/pnpm run db:generate exited (1)
@repo/db:build: [[email protected]] injecting env (0) from .env.example -- tip: 🛠️ run anywhere with `dotenvx run -- yourcommand`
@repo/db:build: Loaded Prisma config from prisma.config.ts.
@repo/db:build:
@repo/db:build: ELIFECYCLE Command failed with exit code 130.
@repo/db#db:generate: command (/vercel/path0/packages/db) /pnpm10/node_modules/.bin/pnpm run db:generate exited (1)
packages/db/prisma.config.ts:
Code: Select all
import "dotenv/config";
import { defineConfig, env } from "prisma/config";
import fs from "fs";
import dotenv from "dotenv";
if (fs.existsSync(".env")) {
dotenv.config({ path: ".env" });
} else {
dotenv.config({ path: ".env.example" });
}
export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
},
engine: "classic",
datasource: {
url: env("DATABASE_URL"),
},
});
turbo.json
Code: Select all
{
"$schema": "https://turborepo.com/schema.json",
"ui": "tui",
"tasks": {
"build": {
"dependsOn": ["^build", "^db:generate"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**"],
"env": ["DATABASE_URL", "FETCH_BASE_URL", "JWT_SECRET"]
},
"lint": {
"dependsOn": ["^lint"]
},
"check-types": {
"dependsOn": ["^check-types"]
},
"dev": {
"dependsOn": ["^db:generate"],
"cache": false,
"persistent": true
},
"db:generate": {
"cache": false
},
"db:migrate": {
"cache": false,
"persistent": true
},
"db:deploy": {
"cache": false
}
}
}
Mobile version