I’m on prisma 3.1.1 on darwin, I have `binaryTarge...
# prisma-migrate
m
I’m on prisma 3.1.1 on darwin, I have
binaryTargets = ["native", "rhel-openssl-1.0.x"]
set which seems to fetch me these engines. I am wondering how I get the migration engine for RHEL because I need it for packaging my lambdas
Copy code
➜  platform git:(appsync-experiments) ✗ ls -l node_modules/prisma
total 319872
-rw-r--r--   1 cyber  staff     11357 Oct  1 20:00 LICENSE
-rw-r--r--   1 cyber  staff      1849 Oct  1 20:00 README.md
drwxr-xr-x   6 cyber  staff       192 Oct  1 20:00 build
drwxr-xr-x   3 cyber  staff        96 Oct  1 20:00 install
-rwxr-xr-x   1 cyber  staff  35756352 Oct  1 20:00 libquery_engine-darwin.dylib.node
-rwxr-xr-x   1 cyber  staff  43392344 Oct  1 22:35 libquery_engine-rhel-openssl-1.0.x.so.node
-rw-r--r--   1 cyber  staff      3775 Oct  1 20:00 package.json
drwxr-xr-x   3 cyber  staff        96 Oct  1 20:00 preinstall
drwxr-xr-x  12 cyber  staff       384 Oct  1 20:00 prisma-client
-rwxr-xr-x   1 cyber  staff  38358976 Oct  1 20:01 query-engine-darwin
-rwxr-xr-x   1 cyber  staff  46242672 Oct  1 22:35 query-engine-rhel-openssl-1.0.x
drwxr-xr-x   4 cyber  staff       128 Oct  1 20:00 scripts
➜  platform git:(appsync-experiments) ✗ ls -l node_modules/@prisma/engines
total 155176
-rw-r--r--  1 cyber  staff       537 Oct  2 10:10 README.md
drwxr-xr-x  8 cyber  staff       256 Oct  2 10:10 dist
drwxr-xr-x  4 cyber  staff       128 Oct  2 10:10 download
-rwxr-xr-x  1 cyber  staff  17649048 Oct  2 10:10 introspection-engine-darwin
-rwxr-xr-x  1 cyber  staff  35756352 Oct  2 10:10 libquery_engine-darwin.dylib.node
-rwxr-xr-x  1 cyber  staff  21082432 Oct  2 10:10 migration-engine-darwin
-rw-r--r--  1 cyber  staff       648 Oct  2 10:10 package.json
-rwxr-xr-x  1 cyber  staff   4946872 Oct  2 10:10 prisma-fmt-darwin
t
Same here.
Copy code
2021-10-02T11:23:01.746Z	1a86ce88-4ff4-49ba-9a78-0003659737cf	INFO	prisma migrate deploy exited with error Command failed: /var/task/node_modules/prisma/build/index.js migrate deploy

Error: Could not find libquery-engine binary. Searched in /var/task/node_modules/prisma/libquery_engine-rhel-openssl-1.0.x.so.node and /var/task/node_modules/libquery_engine-rhel-openssl-1.0.x.so.node
r
I don’t think it’s possible to specify exactly but let me check and confirm.
m
I think I got it pretty much fixed by running
npm install
in docker for my layer - https://github.com/jetbridge/jetkit-cdk/blob/runtime-pkg-prismalayer/packages/cdk/src/cdk/lambda/prismaLayer.ts this version appears to basically work with the exception of prisma-appsync loading prisma is still adding around 1s-1.5s to my lambda cold start time though 😞
r
Even with
nApi
?
m
yes with 3.1.1 default setup
👍 1
i’m trying to profile it, sometimes maybe 0.75s, hope to have more info later today https://prisma.slack.com/archives/CCWDULGUW/p1633011980135600
💯 1
t
I think I fixed my problem. Problem was that naming was changed and the new binary file wasn't included in my generated zip-file
However, I'm running low on space for my lambda. 😕 Current unzipped size is 275mb and I need to be below 262mb.
Forgot a small typo, it's now being included correctly, but size is even higher => 318mb. Other packages in there of course, but did the size increase over the last releases?
m
it can download a few copies of the engines. try out my lambda layer posted above (if you’re using CDK)
t
Oh, just noticed that
node_modules/prisma
also includes libquery engines
Ah, I think I know why. I added the
binaryTargets
to the prisma file after seeing it in your code-snippet
Also, I guess this is also not needed?
node_modules/prisma/libquery_engine-darwin.dylib.node
m
if you use docker to install the node_modules in the layer and then set external_modules to the exact right set then it (the layer) should work okay and be about ~90mb
t
I'm not using docker.
rm -r node_modules && PRISMA_CLI_BINARY_TARGETS=darwin,rhel-openssl-1.0.x npm i && npm run build:tsc && repack-zip
I've excluded paths that you removed in your script
My size is sadly filled with some other libraries (aws-sdk for example)
m
t
nice!
I already excluded most of those, but a good list nevertheless. Problem seems to be solved now btw:
All migrations have been successfully applied.
m
🥳
🎉 1
by the way there is a migration lambda function in jetkit/cdk too…