Skip to content

#1926 - carrot #2373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/build/src/extensions/prisma.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BuildManifest, BuildTarget } from "@trigger.dev/core/v3";
import { binaryForRuntime, BuildContext, BuildExtension } from "@trigger.dev/core/v3/build";
import { readFileSync } from "node:fs";
import assert from "node:assert";
import { existsSync } from "node:fs";
import { cp, readdir } from "node:fs/promises";
Expand Down Expand Up @@ -85,6 +86,27 @@ export class PrismaExtension implements BuildExtension {
`PrismaExtension could not find the prisma schema at ${this._resolvedSchemaPath}. Make sure the path is correct: ${this.options.schema}, relative to the working dir ${context.workingDir}`
);
}

// --- Additional diagnostics for Prisma 6.6+ support ---
try {
const schemaContents = readFileSync(this._resolvedSchemaPath, "utf-8");
const generatorBlocks = [...schemaContents.matchAll(/generator\s+(\w+)\s+\{([\s\S]*?)\}/g)].map((m) => {
const body = (m[2] ?? "") as string;
const provider = body.match(/provider\s*=\s*["']([^"']+)["']/)?.[1];
const output = body.match(/output\s*=\s*["']([^"']+)["']/)?.[1];
return {
name: m[1],
provider,
output,
};
});

context.logger.debug(`Prisma generators detected`, {
generators: generatorBlocks,
});
} catch (err) {
context.logger.warn(`Failed to parse generators from prisma schema: ${(err as Error).message}`);
}
}

async onBuildComplete(context: BuildContext, manifest: BuildManifest) {
Expand Down Expand Up @@ -114,6 +136,11 @@ export class PrismaExtension implements BuildExtension {

const usingSchemaFolder = dirname(this._resolvedSchemaPath).endsWith("schema");

context.logger.debug(`Schema folder detection`, {
usingSchemaFolder,
schemaPath: this._resolvedSchemaPath,
});

const commands: string[] = [];

let prismaDir: string | undefined;
Expand Down