hey all — using prisma+seed and having trouble inc...
# seed
e
hey all — using prisma+seed and having trouble including the
schema.prisma
in the .zip package generated we’re using
packages.individually=true
,
packages.pattern=./schema.prisma
. Using those, the output is like:
lambda.zip
expanded: • schema.prisma • subfolder/ ◦ sub subfolder/ ▪︎ index.js ▪︎ index.js.map and I get an error that
schema.prisma
isn’t found in
sub subfolder
. any way to include that
schema.prisma
file down there/does anyone know what the best way to include
.prisma
files is here? we’re using
serverless-esbuild
+ seed
FWIW, we’re not married to
prisma
(we have Hasura but have found it to be slow, using prisma for a slow but frequent query so could use any ORM)
f
Hey @Ekansh Vinaik, just to clarify, the issue is that the
scheme.prisma
file is packaged to the wrong path in the zip right?
Can you try running
serverless package
locally and see if the path is correct?
e
yep! It’s not really a seed issue, just looking for pointers to get that file packaged in (i.e. do I use a
before_X
hook, if so what does it look like, etc.)
yes — is there a way to
serverless package
and see the individual packages? I couldn’t get this working locally, had to deploy to a Lambda and download the zip to see the individual zip (i.e.
packages.individually=true
in serverless.yml is seemingly not respected when running
serverless package
)
f
Ah gotcha.
You can run
serverless package
locally, and u should be able to find the zip inside the
.serverless
folder.
e
Gotcha, trying it out now
f
I’m not too familiar with Prisma. But if you manage to have it packaged correctly locally, I’m sure we can figure out what needs to go into
before_build
.
e
I can get the
schema.prisma
at the root of the
.zip
from
serverless package
, but it’s not adjacent to the generated
index.js
. Wondering if there’s a command I can run before the files get zipped to move it over? Structure of zip: •
schema.prisma
subfolder/
subfolder/
▪︎
index.js
▪︎
index.js.map
Wanted structure: •
subfolder/
subfolder/
▪︎
index.js
▪︎
index.js.map
▪︎
schema.prisma
f
This GH thread seems to suggest u can’t? I’m not sure if there’s a plugin that can move the files for you.
There’s also this plugin that allow u to hook into sls life cycles https://github.com/jlopez/serverless-hooks
e
okay, ended up writing my own plugin to copy the files in
it works locally with
serverless package
/
serverless invoke local
, but I think copying the files does something weird on Seed?
Copy code
Error: EFAULT: bad address in system call argument, read
    at Object.readSync (fs.js:592:3)
    at Object.fs.readSync (/tmp/seed/source/node_modules/serverless/node_modules/graceful-fs/polyfills.js:154:28)
    at tryReadSync (fs.js:366:20)
    at Object.readFileSync (fs.js:395:19)
    at /tmp/seed/source/node_modules/serverless-esbuild/dist/utils.js:125:47
    at Array.forEach (<anonymous>)
    at WriteStream.<anonymous> (/tmp/seed/source/node_modules/serverless-esbuild/dist/utils.js:121:27)
    at WriteStream.emit (events.js:315:20)
    at WriteStream.EventEmitter.emit (domain.js:467:12)
    at /tmp/seed/source/node_modules/serverless-esbuild/node_modules/graceful-fs/graceful-fs.js:335:14
    at /tmp/seed/source/node_modules/serverless-esbuild/node_modules/graceful-fs/graceful-fs.js:362:16
    at /tmp/seed/source/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:362:16
    at FSReqCallback.oncomplete (fs.js:171:23)
Getting that error after copying files from
curr-dir/node_modules
to
build.initialOptions.outdir