1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
1
Hi,
You are getting this error because you are trying to use the CDK project's package.json to be used by your Lambda Function too. But, it doesn't work that way.
There are 2 options to achieve this:
- You can create a separate runtime environment (i.e. package.json) for your lambda, and then install the "axios" dependency into it. [1]
- You can also choose to create a Lambda Layer that includes the "axios" dependency and configure the Lambda function to use the Lambda Layer.
For ease, you can go with the first option. Here's a reference for it: [1]. The folder structure should look like this:
|-- lambdas/
| |-- package.json
| |-- index.ts
|-- bin/
|-- lib/
|-- package.json
|-- ...
References:
[1] https://stackoverflow.com/questions/67361096/how-can-i-zip-node-lambda-dependencies-in-aws-cdk-stack
[2] https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda-readme.html
Thanks,
Atul
répondu il y a 8 mois
Contenus pertinents
- demandé il y a un an
- demandé il y a un an
- demandé il y a 3 mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 5 mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans