Finding schema.prisma without __dirname
#14484
Labels
bug/1-unconfirmed
Bug should have enough information for reproduction, but confirmation has not happened yet.
domain/client
Issue in the "Client" domain: Prisma Client, Prisma Studio etc.
kind/bug
A reported bug.
topic: deployment/aws-lambda
topic: __dirname
topic: esm
topic: schema file
Bug description
From slack: https://prisma.slack.com/archives/CCWDULGUW/p1657602998648169
I have an issue with creating lambda function bundles with prisma. I'm using ESM and
__dirname
is not defined, but used in the prisma client to find theschema.prisma
file as best I can tell.I can hack around this by creating an ESM shim for dealing with legacy CJS code like the prisma client. This defines __dirname using
import.meta
. See evanw/esbuild#2067 (comment) for details.However I can't tell prisma where my bundle path is since it assumes my schema.prisma is in __dirname. I can work around this by hardcoding
__dirname
in my shim to/var/task
and just always copying the schema.prisma file in there. It doesn't seem like the best solution.How to reproduce
Should get an error
Expected behavior
What would be nice (from best to least best):
Prisma information
4.0.0
Environment & setup
Node 16 lambda
Prisma Version
The text was updated successfully, but these errors were encountered: