-
-
Notifications
You must be signed in to change notification settings - Fork 672
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
bug: prismaExtension
's version detection only works when "@prisma/client" is added to additionalPackages
#1480
Comments
Hi! I understand the issue you're experiencing with the Here's how to resolve this issue:
import { defineConfig } from "@trigger.dev/sdk/v3";
import { additionalPackages } from "@trigger.dev/build/extensions/core";
import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
export default defineConfig({
build: {
extensions: [
prismaExtension({
schema: "prisma/schema.prisma"
// Note: You don't need to specify version when using additionalPackages
}),
additionalPackages({
packages: ["@prisma/[email protected]"]
}),
]
}
}) This configuration ensures that:
Be aware that:
This is currently the recommended workaround until the version detection functionality is improved in a future release. Let me know if you need any clarification or run into any other issues! |
the build also fails if using prismaSchemaFolder extension. If schema.prisma datasource db { And then you create other.prisma and user.prisma.. everything works fine in NextJS.. however trigger.dev build says that schema.prisma is empty and errors out. |
Yes, I'm currently having the same issue.. |
@rharkor can you share your We do support the folders, by following the convention that the enclosing folder should be called
I know that people are using this, so maybe there's some new case here we don't deal with |
Hey thanks for the reply, I've found the issue, it was because I am currently using multiple databases so I finally made my own small extension to handle that, if anyone have the same problem feel free to check the code below (please note that the paths aren't dynamic) import fs from "fs/promises"
import path from "path"
import { BuildExtension } from "@trigger.dev/build"
export function prismaExtension(): BuildExtension {
return {
name: "prisma-extension",
externalsForTarget(target) {
if (target === "dev") {
return []
}
return ["@prisma/client", "@prisma/engines"]
},
onBuildComplete: async (context, manifest) => {
context.logger.debug("Copying the prisma schema to the output directory")
//* Main database
await fs.cp(
path.join(__dirname, "../../../../../packages/database/main/prisma"),
path.join(manifest.outputPath, "main-prisma", "prisma"),
{ recursive: true }
)
//* Logs database
await fs.cp(
path.join(__dirname, "../../../../../packages/database/logs/prisma"),
path.join(manifest.outputPath, "logs-prisma", "prisma"),
{ recursive: true }
)
context.logger.debug(`Adding the prisma layer with the following commands`, {
commands: ["cd main-prisma && npx prisma generate", "cd logs-prisma && npx prisma generate"],
env: {},
dependencies: {
prisma: "latest",
},
})
context.addLayer({
id: "prisma",
commands: ["cd main-prisma && npx prisma generate", "cd logs-prisma && npx prisma generate"],
dependencies: {
prisma: "latest",
},
build: {
env: {},
},
})
},
}
} |
@rharkor nice! |
Provide environment information
System:
OS: macOS 15.1
CPU: (11) arm64 Apple M3 Pro
Memory: 133.08 MB / 18.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.0 - /opt/homebrew/opt/node@20/bin/node
npm: 10.8.2 - /opt/homebrew/opt/node@20/bin/npm
pnpm: 9.12.3 - /opt/homebrew/opt/node@20/bin/pnpm
Describe the bug
Running
pnpm dlx trigger.dev@latest deploy
fails when usingprismaExtension
's default config.Based on this doc, the
prismaExtension
should automatically detect the installed version. Without aversion
, the deployment succeeds and silently reports an error:When adding
version: "5.22.0"
, the deployment fails entirely:Here's a snippet of the build error:
Workaround
Adding "@prisma/client" to
additionalPackages
fixes the issue:Reproduction repo
https://github.com/gmathieu/trigger-prisma-bug
To reproduce
pnpm install
project
with your project ID intrigger.config.ts
Note: Don't worry about
DATABASE_URL
warnings, we're only testing the deployment cycle.Scenario 1: silent failure
pnpm trigger deploy
Scenario 2: build failure with version
pnpm trigger deploy
Scenario 3: successful deployment with
additionalPackages
pnpm trigger deploy
Note:
additionalPackages
properly populates the manifest's externals here, so version can be omitted.Additional information
No response
The text was updated successfully, but these errors were encountered: