Lambda function, created with CDK (typescript, using NodejsFunction from 'aws-cdk-lib/aws-lambda-nodejs') does not import module from the pre-existing layer in my account #29656
Unanswered
alexeireznik
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
CDK v. 2.134.0 / Typescript
Simple example of the problem: I have a 'lodash' layer in my AWS lambda account, created using console by uploading the .zip file made from lodash npm package. The layer could be attached and works fine for several lambdas, created using console.
The goal is to be able to use the same layer in the lambda function, created as part of the stack using CDK / Typescript and NodejsFunction from 'aws-cdk-lib/aws-lambda-nodejs'
The layer:
The function:
Layer attached:
The handler (get.ts)
Building process (using esbuild) goes with no errors/warnings, the layer is attached to the function.
The problem when testing from the console or running within the stack:
I went through multitude of posts describing how to manage layers from scratch, but nothing about this situation, meaning that I'm doing something wrong. In AWS docs it seems that nothing else is needed and it should work, but it doesn't.
Beta Was this translation helpful? Give feedback.
All reactions