#Using prisma schema folder throws error

1 messages ยท Page 1 of 1 (latest)

cunning fog
sinful ventureBOT
#

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:

cunning fog
#

Using prisma schema folder throws error

sinful ventureBOT
#

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.

#

@cunning fog Kapa.ai is still learning and improving, please let me know how I did by reacting below.

cunning fog
#
 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

https://github.com/triggerdotdev/trigger.dev/blob/0b2eb34ea6282f72fedd2b3f677ecde633304932/packages/build/src/extensions/prisma.ts#L157

GitHub

Trigger.dev โ€“ open source background jobs and AI infrastructure - triggerdotdev/trigger.dev

errant lava
#

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.

cunning fog
#

@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

https://github.com/triggerdotdev/trigger.dev/blob/0b2eb34ea6282f72fedd2b3f677ecde633304932/packages/build/src/extensions/prisma.ts#L186

errant lava
#

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?

cunning fog
errant lava
#

Hmm does that means it's solvable on your end do you think?

cunning fog
#

no errors out on 6.5.0 as well

#

yes, i haven't deployed to trigger since switching to multi schema prisma

errant lava
#

If you delete the .trigger cache folder on 6.5.0, does it do it?

cunning fog
#

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)
cunning fog
errant lava
#

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