jetbridge / jetbridge/sst-prisma
Where does the generated PrismaClient belong?
- Dominant language
- TypeScript
- Stars
- 209
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the PrismaLayer stack code and its bundle command, especially the rm -rf .prisma step, then compare that with the package.json postinstall generate script. Reproduce the Lambda initialization error and determine where the generated PrismaClient must be present for the function to initialize successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100