John Kor
12/30/2021, 6:38 AMRuntime.ImportModuleError
error. i have a simple sqs queue with a lambda fn attached as a consumer. ive added mysql2
and knex
as layers. the specific error is that the module knex
cannot be found during runtime. any advice on how to debug this issue? thanks in advance!Sam Hulick
12/30/2021, 6:52 AMapp.setDefaultFunctionProps(stack => ({
// ...
bundle: {
// sharp is a binary, and we have it in a Lambda layer, so exclude it
externalModules: [
'sharp',
'knex',
'@aws-sdk/signature-v4-crt',
],
loader: {
'.node': 'binary',
},
},
layers: [
lambda.LayerVersion.fromLayerVersionArn(
stack,
'KnexLayer',
process.env.KNEX_LAYER_ARN
),
],
John Kor
12/30/2021, 8:52 PMnodeModules
option under bundle
🙂 so similar to the snippet you shared