threadsnips
threadsnips
PPrisma
Created by threadsnips on 11/4/2024 in #help-and-questions
Using Prisma Client (and libquery engine) on AWS SAM without Layers
Hi, I am trying to get the Prisma client libquery engine to work directly inside the Lambda. I have one root package.json where I install prisma deps, and I am trying to import the engine with import x from '../../node_modules/.prisma/.../.so.node, but that was giving me issues unable to resolve the module or find type declarations. Then I tried to use tsconfig.json to set up some paths for it to find the engine file, but no success. That is, whenever I would run sam build I would get the schema.prisma in the build folder but not the libquery...so.node. I eventually stumbled across the idea to change the output folder (/generated/client) to the same local folder (i.e. src/common/prisma) where I have my schema.prisma and now I get the libquery engine as part of the sam build. The issue now is Im getting errors with Dynamic require of "fs" not supported as I have set up my project to use SAM's built-in transpiler using ESM format. I'm not sure where to go to get this setup working. Is it even possible to use Prisma directly with Lambdas and with Layers, or should I be very strongly considering using a Layer to get this working?
1 replies