Is anyone familiar with trying to use prisma-bindi...
# orm-help
z
Is anyone familiar with trying to use prisma-bindings in a lambda function?
d
Yes, please let me know if you have a more specific question?
z
Hi! I've been stuck all day on this issue. I've copied over my generated prisma.ts file to my serverless directory, and instantiated prisma with it normally. However, whenever I try to invoke the lambda, I get an error saying "Cannot find module 'graphql'"
Of course graphql is listed as a direct dependency and I've confirmed its being included in the package that serverless is sending to lambda
d
Can you share your code as a reproduction and create an issue?
z
I doubt this is an issue with Prisma... To try to clarify my situation a little better: I've copied my generated
prisma.ts
file from my graphql server (which contains my prisma directory as in the examples) into my separate serverless folder. I did this so that I could call the Prisma constructor exposed by prisma.ts. I'm under the impression that
prisma.ts
is only used in the typescript compilation stage and should have no effect on the lambda's execution once it is built and deployed. Nonetheless I'm getting a
cannot find module: graphql
error, while my code never directly imports graphql. Nevertheless I have graphql installed as a dependency, so it shouldnt be an issue in the first place
If I remove the
import { Prisma } from "./prisma"
the error goes away. I tried using the javascript version of the prisma constructor by passing in the generated schema file as a string directly, but it resulted in the same error
Do you have a sample of how you are importing your generated prisma files into your lambda?
I fixed this by rimrafing my node_modules, cleaning my npm cache, and adding
graphql
not only as a dependency but as a resolution
d
Interesting! I would still recommend you to create an issue to help others who run into it and for us to investigate 👍