#Using prisma schema folder throws error
1 messages ยท Page 1 of 1 (latest)
Hi @cunning fog. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Using prisma schema folder throws error
It seems you're experiencing an issue where using a Prisma schema folder with Trigger.dev throws an error but continues to work. This is likely related to the Prisma build extension configuration in your trigger.config.ts file.
When using Prisma with Trigger.dev, you need to configure the Prisma build extension properly. You can specify either the full path to your schema file using the schema option or just the directory containing your schema file using the prismaSchemaFolder option.
Here's how to properly configure the Prisma extension in your trigger.config.ts file:
import { defineConfig } from "@trigger.dev/sdk/v3";
import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
export default defineConfig({
project: "<project ref>",
build: {
extensions: [
prismaExtension({
version: "5.20.0", // optional, we'll automatically detect the version if not provided
schema: "prisma/schema.prisma", // use this for specifying the exact schema file
// OR
// prismaSchemaFolder: "prisma", // use this to specify just the directory
}),
],
},
});
The error you're seeing might be related to how the Prisma extension is configured, but since it continues to work, it's likely that the extension is still finding your schema file despite the error.
For more detailed information about configuring the Prisma extension, you can check the Prisma build extension documentation.
If you're working in a monorepo setup, you might want to look at the example projects that demonstrate how to use Prisma and Trigger.dev together:
- Turborepo monorepo with Trigger.dev and Prisma packages
- Turborepo monorepo with a Prisma package and Trigger.dev installed in a Next.js app
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@cunning fog Kapa.ai is still learning and improving, please let me know how I did by reacting below.
build: {
extensions: [
prismaExtension({
schema: "prisma/schema",
}),
ffmpeg(),
],
},
So it looks like you are trying to copy the schema folder to a schema file
PrismaExtension is generating the Prisma client for version 6.6.0
Copying the prisma schema from /Users/mfts/dev/mfts/papermark-main/prisma/schema to /Users/mfts/dev/mfts/papermark-main/.trigger/tmp/build-HgewCc/prisma/schema.prisma
โ [ERROR] Failed to apply extension PrismaExtension onBuildComplete SystemError [ERR_FS_EISDIR]: Path is a directory: cp returned EISDIR (/Users/mfts/dev/mfts/papermark-main/prisma/schema is a directory (not copied)) /Users/mfts/dev/mfts/papermark-main/prisma/schema
but according to this file it should be detecting the schema folder and then copy the contents
We should document this better. I think you're meant to point it at the main schema file in your folder and it will automatically figure out if it's a folder full of them
If you point it at one of the schemas in your folder does it work?
This did work, although Prisma have been changing quite a lot of things lately.
@errant lava
Adding prisma/schema/schema.prisma detected all prisma files from the folder
but building still didn't work
it looks like the prisma script is only looking for schema.prisma or prisma/schema.prisma
so the schema files get copied over to
Copying the prisma schema from /Users/mfts/dev/mfts/papermark-main/prisma/schema/conversation.prisma to /Users/mfts/dev/mfts/papermark-main/.trigger/tmp/build-VEBi4b/prisma/schema/conversation.prisma
Copying the prisma schema from /Users/mfts/dev/mfts/papermark-main/prisma/schema/dataroom.prisma to /Users/mfts/dev/mfts/papermark-main/.trigger/tmp/build-VEBi4b/prisma/schema/dataroom.prisma
Copying the prisma schema from /Users/mfts/dev/mfts/papermark-main/prisma/schema/link.prisma to /Users/mfts/dev/mfts/papermark-main/.trigger/tmp/build-VEBi4b/prisma/schema/link.prisma
Copying the prisma schema from /Users/mfts/dev/mfts/papermark-main/prisma/schema/schema.prisma to /Users/mfts/dev/mfts/papermark-main/.trigger/tmp/build-VEBi4b/prisma/schema/schema.prisma
but this command doesn't find the schema files
Are you using the new Prisma stuff where it doen't create the client in node_modules?
Have you just started using the multiple files Prisma stuff?
ok it may be related to prisma 6.6.0
https://www.prisma.io/docs/orm/prisma-schema/overview/location#:~:text=As of,location any more.
Hmm does that means it's solvable on your end do you think?
no errors out on 6.5.0 as well
yes, i haven't deployed to trigger since switching to multi schema prisma
If you delete the .trigger cache folder on 6.5.0, does it do it?
Seems like this may be a fix that's backwards compatible
As of v6.6.0, you must always explicitly specify the location of your Prisma schema folder. There is no "magic" detection of the Prisma schema folder in a default location any more.
You can do this in either of three ways:
- pass the the --schema option to your Prisma CLI command (e.g. prisma migrate dev --schema ./prisma/schema)
throws the same cannot find schema.prisma file
nevermind. it works on 6.5.0
god i hate npm and git branching
OK so we need to fix 6.6+ ๐
They also have this thing where they're not going to generate it in node_modules anymore. Which makes a lot of sense (they should have done it like that in the first place), but it's going to be a nightmare for us as people migrate ๐ข
I'll create a GitHub issue for this now
We use Prisma and generally like it, but the building process has always been terrible