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
Sometimes SAM has an issue getting versions of libraries it needs for the build process, this problem manifests as the following error:
15:59:54 Error: NodejsNpmBuilder:NpmInstall - NPM Failed: npm WARN config production Use --omit=dev instead. 15:59:54 npm ERR! code ETARGET 15:59:54 npm ERR! notarget No matching version found for @babel/helper-validator-identifier@^7.25.7. 15:59:54 npm ERR! notarget In most cases you or one of your dependencies are requesting 15:59:54 npm ERR! notarget a package version that doesn't exist.
But the build does not stop after that, it generates a faulty package and we do not get an error code, so our CI/CD pipeline continues with the sam deploy command and deploys the faulty package that does not work at all.
Steps to reproduce:
It happens when a library that SAM uses gets a new version, I'm not sure if this behavior can be simulated some other way.
Observed result:
On 09/16 this error happened with the following library:
15:58:02 Building layer 'SDPLayers/BackendLayer' 15:58:02 WARNING: Layer 'BackendLayer' has BuildArchitecture x86_64, which is not listed in CompatibleArchitectures 15:58:02 Running NodejsNpmBuilder:NpmPack 15:58:03 Running NodejsNpmBuilder:CopyNpmrcAndLockfile 15:58:03 Running NodejsNpmBuilder:CopySource 15:58:03 Running NodejsNpmBuilder:NpmInstall 15:59:54 15:59:54 Build Failed 15:59:54 Error: NodejsNpmBuilder:NpmInstall - NPM Failed: npm WARN config production Use --omit=dev instead. 15:59:54 npm ERR! code ETARGET 15:59:54 npm ERR! notarget No matching version found for @babel/helper-validator-identifier@^7.25.7. 15:59:54 npm ERR! notarget In most cases you or one of your dependencies are requesting 15:59:54 npm ERR! notarget a package version that doesn't exist. 15:59:54 15:59:54 npm ERR! A complete log of this run can be found in: 15:59:54 npm ERR! /home/node/.npm/_logs/2024-10-02T18_58_02_731Z-debug-0.log 15:59:58 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 262144 / 1736109 (15.10%) 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 524288 / 1736109 (30.20%) 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 786432 / 1736109 (45.30%) 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 1048576 / 1736109 (60.40%) 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 1310720 / 1736109 (75.50%) 15:59:59 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 1572864 / 1736109 (90.60%) 15:59:59 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 1736109 / 1736109 (100.00%) 15:59:59 15:59:59 Uploading to sdp-dev-stack/8fa6a45e0956f135560f0174b206b041.template 912 / 912 (100.00%)
Expected result:
SAM should throw an error code so that the CI/CD scripts can know there was an error on the build and abort the deployment. We get the "Build failed" message but it seems that the code returned is zero, otherwise our pipelines would abort
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
OS: Linux
sam --version: 1.120.0
AWS region: us-east-1
The text was updated successfully, but these errors were encountered:
pguartes-endava
changed the title
Bug: SAM build does not abort when missing node library
Bug: SAM build does not abort when missing npm library
Oct 2, 2024
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Description:
Sometimes SAM has an issue getting versions of libraries it needs for the build process, this problem manifests as the following error:
15:59:54 Error: NodejsNpmBuilder:NpmInstall - NPM Failed: npm WARN config production Use --omit=dev instead. 15:59:54 npm ERR! code ETARGET 15:59:54 npm ERR! notarget No matching version found for @babel/helper-validator-identifier@^7.25.7. 15:59:54 npm ERR! notarget In most cases you or one of your dependencies are requesting 15:59:54 npm ERR! notarget a package version that doesn't exist.
But the build does not stop after that, it generates a faulty package and we do not get an error code, so our CI/CD pipeline continues with the
sam deploy
command and deploys the faulty package that does not work at all.Steps to reproduce:
It happens when a library that SAM uses gets a new version, I'm not sure if this behavior can be simulated some other way.
Observed result:
On 09/16 this error happened with the following library:
https://www.npmjs.com/package/@smithy/node-config-provider
16:52:54 npm ERR! notarget No matching version found for @smithy/node-config-provider@^3.1.6.
Today on 02/10 it happened with this library
https://www.npmjs.com/package/@babel/helper-validator-identifier
15:58:02 Building layer 'SDPLayers/BackendLayer' 15:58:02 WARNING: Layer 'BackendLayer' has BuildArchitecture x86_64, which is not listed in CompatibleArchitectures 15:58:02 Running NodejsNpmBuilder:NpmPack 15:58:03 Running NodejsNpmBuilder:CopyNpmrcAndLockfile 15:58:03 Running NodejsNpmBuilder:CopySource 15:58:03 Running NodejsNpmBuilder:NpmInstall 15:59:54 15:59:54 Build Failed 15:59:54 Error: NodejsNpmBuilder:NpmInstall - NPM Failed: npm WARN config production Use --omit=dev instead. 15:59:54 npm ERR! code ETARGET 15:59:54 npm ERR! notarget No matching version found for @babel/helper-validator-identifier@^7.25.7. 15:59:54 npm ERR! notarget In most cases you or one of your dependencies are requesting 15:59:54 npm ERR! notarget a package version that doesn't exist. 15:59:54 15:59:54 npm ERR! A complete log of this run can be found in: 15:59:54 npm ERR! /home/node/.npm/_logs/2024-10-02T18_58_02_731Z-debug-0.log 15:59:58 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 262144 / 1736109 (15.10%) 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 524288 / 1736109 (30.20%) 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 786432 / 1736109 (45.30%) 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 1048576 / 1736109 (60.40%) 15:59:58 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 1310720 / 1736109 (75.50%) 15:59:59 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 1572864 / 1736109 (90.60%) 15:59:59 Uploading to sdp-dev-stack/bc137888fe1f28514c7a745dd59ee3b5 1736109 / 1736109 (100.00%) 15:59:59 15:59:59 Uploading to sdp-dev-stack/8fa6a45e0956f135560f0174b206b041.template 912 / 912 (100.00%)
Expected result:
SAM should throw an error code so that the CI/CD scripts can know there was an error on the build and abort the deployment. We get the "Build failed" message but it seems that the code returned is zero, otherwise our pipelines would abort
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.120.0The text was updated successfully, but these errors were encountered: