Kay Khan
07/12/2022, 10:10 AMgenerator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
serverless.ts
package: {
individually: true,
patterns: [
"!node_modules/.prisma/client/libquery_engine-*",
"node_modules/.prisma/client/libquery_engine-rhel-*",
"!node_modules/prisma/libquery_engine-*",
"!node_modules/@prisma/engines/**",
],
},
npx prisma generate && npm install
sls invoke local -f main
✖️ Error: ENOENT: no such file or directory, open ''/.esbuild/.build/node_modules/.prisma/client/schema.prisma'What am i doing wrong here? attempting to follow this example: https://github.com/prisma/prisma-examples/tree/latest/deployment-platforms/aws-lambda • note: i am using the serverless
aws-nodejs-typescirpt template which uses serverless-esbuild and not serverless-webpackMarcos Iglesias
07/12/2022, 11:35 AMinject: ['../../prisma/schema.prisma',
'../../node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node',
'../../node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node',
],
assetNames: './[name]',
loader: { '.prisma': 'file', '.node': 'file' },
this is what I added in my custom esbuild config for local, and, of course when deploying, not considering it.Kay Khan
07/12/2022, 11:36 AMKay Khan
07/12/2022, 11:38 AMMarcos Iglesias
07/12/2022, 11:42 AMMarcos Iglesias
07/12/2022, 11:42 AMKay Khan
07/12/2022, 11:49 AMKay Khan
07/12/2022, 11:49 AMMarcos Iglesias
07/12/2022, 11:49 AMKay Khan
07/12/2022, 11:50 AMcustom: {
esbuild: {
bundle: true,
minify: false,
sourcemap: true,
exclude: ["aws-sdk"],
target: "node16",
define: { "require.resolve": undefined },
platform: "node",
concurrency: 10,
},
},Marcos Iglesias
07/12/2022, 11:51 AMcustom: {
esbuild: {
bundle: true,
minify: false,
sourcemap: true,
exclude: ["aws-sdk"],
target: "node16",
define: { "require.resolve": undefined },
platform: "node",
concurrency: 10,
inject: [
'../../prisma/schema.prisma',
'../../node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node',
'../../node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node',
],
assetNames: './[name]',
loader: { '.prisma': 'file', '.node': 'file' },
},
},
you will need to resolve the correct paths and where the "assets" are going to be injected accoding to your project structure of courseMarcos Iglesias
07/12/2022, 11:52 AMKay Khan
07/12/2022, 11:52 AMQuery engine library for current platform "debian-openssl-1.1.x" could not be found.
You incorrectly pinned it to debian-openssl-1.1.xKay Khan
07/12/2022, 11:53 AMKay Khan
07/12/2022, 11:53 AMKay Khan
07/12/2022, 11:55 AMpackage: {
individually: true,
patterns: [
"!node_modules/.prisma/client/libquery_engine-*",
"node_modules/.prisma/client/libquery_engine-rhel-*",
"node_modules/.prisma/client/schema.prisma",
"node_modules/.prisma/client/libquery_engine-debian-*",
"!node_modules/prisma/libquery_engine-*",
"!node_modules/@prisma/engines/**",
],
},
Now i have them in the build
esbuild/.build/node_modules/.prisma/client master ± ls
libquery_engine-debian-openssl-1.1.x.so.node
schema.prisma
libquery_engine-rhel-openssl-1.0.x.so.node
and it worksMarcos Iglesias
07/12/2022, 11:56 AMKay Khan
07/12/2022, 11:56 AMMarcos Iglesias
07/12/2022, 11:56 AMMarcos Iglesias
07/12/2022, 11:56 AMKay Khan
07/12/2022, 11:57 AMKay Khan
07/12/2022, 11:57 AMMarcos Iglesias
07/12/2022, 11:57 AMKay Khan
07/12/2022, 11:57 AMMarcos Iglesias
07/12/2022, 11:57 AMKay Khan
07/12/2022, 11:57 AMKay Khan
07/12/2022, 11:58 AMMarcos Iglesias
07/12/2022, 11:58 AMMarcos Iglesias
07/12/2022, 11:59 AMKay Khan
07/12/2022, 11:59 AMsls invoke local -f main when this is deployed why does it not require thsese engines?Marcos Iglesias
07/12/2022, 11:59 AMKay Khan
07/12/2022, 11:59 AMMarcos Iglesias
07/12/2022, 12:00 PMKay Khan
07/12/2022, 12:00 PMMarcos Iglesias
07/12/2022, 12:00 PMKay Khan
07/12/2022, 12:00 PMMarcos Iglesias
07/12/2022, 12:00 PMKay Khan
07/12/2022, 12:01 PMMarcos Iglesias
07/12/2022, 12:01 PMKay Khan
07/12/2022, 12:01 PMKay Khan
07/12/2022, 12:01 PMKay Khan
07/12/2022, 12:04 PMMarcos Iglesias
07/12/2022, 12:04 PMKay Khan
07/12/2022, 12:05 PMMarcos Iglesias
07/12/2022, 12:05 PMKay Khan
07/12/2022, 12:05 PMpackage: {
individually: true,
patterns: [
"!node_modules/.prisma/client/libquery_engine-*",
"node_modules/.prisma/client/schema.prisma",
"node_modules/.prisma/client/libquery_engine-debian-*",
"!node_modules/prisma/libquery_engine-*",
"!node_modules/@prisma/engines/**",
],
},Marcos Iglesias
07/12/2022, 12:05 PMKay Khan
07/12/2022, 12:05 PMKay Khan
07/12/2022, 12:05 PMKay Khan
07/12/2022, 12:06 PMMarcos Iglesias
07/12/2022, 12:07 PMKay Khan
07/12/2022, 12:08 PMKay Khan
07/12/2022, 12:08 PMMarcos Iglesias
07/12/2022, 12:08 PMMarcos Iglesias
07/12/2022, 12:08 PMKay Khan
07/12/2022, 12:08 PMMarcos Iglesias
07/12/2022, 12:08 PMKay Khan
07/12/2022, 12:09 PMKay Khan
07/12/2022, 12:09 PMMarcos Iglesias
07/12/2022, 12:09 PMMarcos Iglesias
07/12/2022, 12:10 PMKay Khan
07/12/2022, 12:15 PMMarcos Iglesias
07/12/2022, 12:16 PMMarcos Iglesias
07/12/2022, 12:16 PMKay Khan
07/12/2022, 12:17 PMKay Khan
07/12/2022, 12:19 PMFantastic! Our function's artifact size is down to ~4.3mb! But look at the size of that layer! 💥 We just moved the bulk from one place to another...
A layer has the same size constraints as a full function does, so this deployment is going to fail.
so i woner if in your case, 1 layer has 2 mb but the other layer has more?Marcos Iglesias
07/12/2022, 12:20 PMKay Khan
07/12/2022, 12:20 PMMarcos Iglesias
07/12/2022, 12:21 PMKay Khan
07/12/2022, 12:22 PMKay Khan
07/12/2022, 1:04 PMKay Khan
07/12/2022, 1:05 PMKay Khan
07/12/2022, 1:05 PMMarcos Iglesias
07/12/2022, 1:06 PMKay Khan
07/12/2022, 1:06 PMMarcos Iglesias
07/12/2022, 1:06 PMKay Khan
07/12/2022, 1:06 PMKay Khan
07/12/2022, 1:07 PMKay Khan
07/12/2022, 1:07 PMMarcos Iglesias
07/12/2022, 1:07 PMKay Khan
07/12/2022, 1:08 PMKay Khan
07/12/2022, 1:08 PMMarcos Iglesias
07/12/2022, 1:09 PMKay Khan
07/12/2022, 1:09 PMMarcos Iglesias
07/12/2022, 1:09 PMMarcos Iglesias
07/12/2022, 1:09 PMMarcos Iglesias
07/12/2022, 1:10 PM