You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: Prisma prismaSchemaFolder extension causes trigger.dev deploy to fail #1565
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.
If all models are thrown into schema.prisma it works.
Tried including additional files in
import { defineConfig } from '@trigger.dev/sdk/v3';
import {
additionalPackages,
additionalFiles,
} from '@trigger.dev/build/extensions/core';
import { prismaExtension } from '@trigger.dev/build/extensions/prisma';
Set up prisma in nextjs with prismaSchemaFolder extension.
Create schema.prisma with no schemas
`generator client {
provider = "prisma-client-js"
previewFeatures = ["prismaSchemaFolder"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
`
Create user.prisma with schemas
`model User {
id String @id@unique
email String @unique
name String?
@@index([email])
}`
Set up trigger.config.ts
import { defineConfig } from '@trigger.dev/sdk/v3';
import {
additionalPackages,
additionalFiles,
} from '@trigger.dev/build/extensions/core';
import { prismaExtension } from '@trigger.dev/build/extensions/prisma';
Trigger.dev fails to deploy. With or without additionalFiles. It does not seem to load in the extension.
Error is simply that there are no models in the schema.prisma
If all models are thrown into schema.prisma it works.
@RobertHH-IS This definitely should work, and I haven't been able to replicate this. Do you think you could publish an actual repo on GitHub that reproduces this issue? That would be extremely helpful if so 🫡
when following the step
pnpm dlx trigger.dev@latest deploy
I get error
18 0.675 Prisma schema loaded from prisma/schema/schema.prisma
18 0.768 Error:
18 0.768 You don't have any models defined in your schema.prisma, so nothing will be generated.
18 0.768 You can define a model like this:
18 0.768
18 0.768 model User {
18 0.768 id Int @id@default(autoincrement())
18 0.768 email String @unique
18 0.768 name String?
18 0.768 }
18 0.768
18 0.768 More information in our documentation:
18 0.768 https://pris.ly/d/prisma-schema
18 0.768
18 ERROR: process "/bin/sh -c node node_modules/prisma/build/index.js generate" did not complete successfully: exit code: 1
i tried it with and without the additionalFiles extension
@RobertHH-IS thanks for the reproduction, I've been able to track down what is going on here. Apparently when using the prismaSchemaFolder preview feature, you have to switch to no longer passing the schema file to CLI commands, and update it to passing the schema dir:
In the package.json of this project you are actually doing that correctly, but the prisma CLI will actually use the setting in the package.json if it exists (and the --schema flag isn't passed into the prisma CLI command):
The trigger.dev deploy command was copying that prisma configuration from your package.json to the container, but it wasn't passing a --schema flag to the generate command pointing to the schema dir. We could fix this on our end by making sure that --schema flag is always passed, but in the meantime, simply changing the package.json to this will fix the problem:
Also, there's no need to use the additionalFiles extension, as we will already detect using multiple .prisma files and copy them into the deployed image.
Activity
ericallam commentedon Dec 14, 2024
@RobertHH-IS This definitely should work, and I haven't been able to replicate this. Do you think you could publish an actual repo on GitHub that reproduces this issue? That would be extremely helpful if so 🫡
RobertHH-IS commentedon Dec 15, 2024
Certainly:
https://github.com/RobertHH-IS/trigger-prismafolder
when following the step
pnpm dlx trigger.dev@latest deploy
I get error
i tried it with and without the additionalFiles extension
ericallam commentedon Dec 15, 2024
@RobertHH-IS thanks for the reproduction, I've been able to track down what is going on here. Apparently when using the
prismaSchemaFolderpreview feature, you have to switch to no longer passing the schema file to CLI commands, and update it to passing the schema dir:In the package.json of this project you are actually doing that correctly, but the prisma CLI will actually use the setting in the package.json if it exists (and the
--schemaflag isn't passed into the prisma CLI command):The
trigger.dev deploycommand was copying that prisma configuration from your package.json to the container, but it wasn't passing a--schemaflag to thegeneratecommand pointing to the schema dir. We could fix this on our end by making sure that--schemaflag is always passed, but in the meantime, simply changing the package.json to this will fix the problem:Also, there's no need to use the
additionalFilesextension, as we will already detect using multiple .prisma files and copy them into the deployed image.RobertHH-IS commentedon Dec 15, 2024
Correct - working now :-)
Thanks!