You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running sam build --build-in-source, the build process fails for the lambda function with an esbuild error. However, sam build without the --build-in-source flag works successfully.
Steps to reproduce:
Set up a SAM project with multiple lambda functions using esbuild.
Run sam build --build-in-source
Expected behavior:
The build process should complete successfully for all lambda functions.
Actual behavior:
The build fails with the following error:
CopyNodejsNpmEsbuildBuilder:EsbuildBundle failed
EsbuildExecutionError: Esbuild Failed: ✘ [ERROR] Could not resolve "@sendgrid/client"
node_modules/@sendgrid/mail/src/classes/mail-service.js:6:25:
6 │ const {Client} = require('@sendgrid/client');
╵ ~~~~~~~~~~~~~~~~~~
You can mark the path "@sendgrid/client" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
Nevermind I found the issue, I had a samconfig.toml file in the project with parallel:true, and npm failed to build with this parameter. You can close the issue if it not considered a bug.
@aleguern-azivko thanks for raising issue and for finding the root cause. If build-in-source doesn't work well with parallel, I believe we should check and not allow them to be active at the same time. Marking it as a bug
When running sam build --build-in-source, the build process fails for the lambda function with an esbuild error. However, sam build without the --build-in-source flag works successfully.
Steps to reproduce:
Set up a SAM project with multiple lambda functions using esbuild.
Run sam build --build-in-source
Expected behavior:
The build process should complete successfully for all lambda functions.
Actual behavior:
Environment:
npm version: 10.5.0
SAM CLI version: 1.124.0
Operating System: macOS
Relevant configuration:
SAM template snippet for the Contact function:
Relevant dependencies from package.json:
The text was updated successfully, but these errors were encountered: