NodejsNpmEsbuildBuilder:EsbuildBundle - Esbuild Failed #8140
Replies: 3 comments
-
It looks like this question was intended for the AWS SAM CLI rather than the AWS CLI. Here is where you can open a discussion: https://github.com/aws/aws-sam-cli/discussions |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
-
Adding the packages those included on the layer as external will resolve that External: !Split [" ", !Ref ExternalDependencies] inside Metadata's BuildProperties while having it on parameter so that if you need it in multiple functions just one line will do that Parameters:
ExternalDependencies:
Type: String
Default: "mysql2 better-sqlite3 oracledb mysql tedious pg-query-stream sqlite3"
Resources
someFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: ....
Handler: ....
Role: ....
Metadata:
BuildMethod: esbuild
BuildProperties:
....
External: !Split [" ", !Ref ExternalDependencies]
.... Replace the default value with your packages want to exclude |
Beta Was this translation helpful? Give feedback.
-
Below is the version of the tool used.
I am currently trying to build a Lambda using Layer.
I tried to build using aws-sam-cli, but Esbuild gave me an error importing layers.
The Lambda template.yaml can be found here.
Information on tsconfig.json can be found here.
I heard that setting External may solve the problem, but when I actually set it, the build error was resolved, but the Lambda stopped working with an error.
After reviewing the error, my sense is that the module on the layer side has not been resolved.
The directory structure is shown here.
I would like to know how to solve this problem aleva.
Beta Was this translation helpful? Give feedback.
All reactions