sst: Prisma example is broken since SST 2.0
I tried to setup a new project using the prisma example, but it does not seem to work with sst2.0
Command: yarn create sst --template=examples/prisma
When running a function that uses a prismaClient instance you receive an error: Your schema.prisma could not be found, and we detected that you are using Next.js
I assume this is because sst is now a monorepo and prisma has some issues with monorepos and needs a workaround to function with nextjs as discussed in their documentation: https://www.prisma.io/docs/guides/database/troubleshooting-orm/help-articles/nextjs-prisma-client-monorepo#problem
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 7
- Comments: 16 (6 by maintainers)
I’m waiting on a fix from prisma since recent versions refuse to find the schema.prisma file when used with SST
@perfectbase I made a repo that I posted about on the the SST discord. Here it is: https://github.com/geauser/sst-prisma-example
You should join the discord as well most people ask questions over there!
Something that has fixed the
schema.prismanot being found issue for me (at least locally - I haven’t tested deploying it yet) was to bundle the external libraries all the time ie.Also, I discovered that if you specify the
outputpath in yourschema.prismafile and then try to import the types, client etc. in a separate module and then try to use that module in your apps, it’ll break too with the__filenameerror. To go around this issue, remove theoutputpath and inside the module that you’ll import all over your apps, just export@prisma/client.Yeah sst-prisma is updated https://github.com/jetbridge/sst-prisma
When running a lambda that accesses a prismaClient instance the following error occurs:
With prisma.schema copied to var/task/services/api/functions -> resolveEnginePath function of prisma accesses __filename which is not defined…