Skip to content

Where does the generated PrismaClient belong? #60

Description

@disbelief

Hi there, thanks for this fantastic example of using SST with Prisma on a Layer.

I've copied your stack code into my SST project, and I'm able to get the PrismaLayer built with the @prisma/* packages installed, but I'm running into problems executing my lambda functions that use the PrismaClient.

It seems that the .prisma directory is expected to be somewhere but it's not. I can't figure out where it should be. I'd assume it belongs on the Layer itself, but the bundle command actually executes rm -rf .prisma

The error I'm seeing in my lambda function is:

Error: @prisma/client did not initialize yet. Please run \"prisma generate\" and try to import it again.
        In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues
            at new PrismaClient (/opt/nodejs/node_modules/.prisma/client/index.js:43:11)
            at getClient (file:///var/task/packages/functions/src/test.mjs:16476:12)
            at async file:///var/task/packages/functions/src/test.mjs:16491:19
            at async file:///var/task/packages/functions/src/test.mjs:16335:16

I have "postinstall": "npm run generate" in my package.json but it doesn't seem to be generating the client (I don't see anything in the function code).

Should the generated Prisma client be on the layer or in the lambda package itself?

Any help/advice would be appreciated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions