-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(lambda-nodejs): copy .npmrc for pnpm to enable private registry authentication #36587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(lambda-nodejs): copy .npmrc for pnpm to enable private registry authentication #36587
Conversation
…uthentication When using nodeModules with pnpm, CDK creates a pnpm-workspace.yaml which prevents pnpm from inheriting .npmrc from parent directories. This fix copies the project's .npmrc to the bundling directory when it exists. Fixes aws#36567
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter fails with the following errors:
❌ Fixes must contain a change to an integration test file and the resulting snapshot.
If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.
✅ A exemption request has been requested. Please wait for a maintainer's review.
|
Exemption Request This fix modifies the Docker bundling command to copy The fix is covered by a unit test that verifies the bundling command includes |
PR Update: Changed approach from file copy to base64 encodingThe initial implementation failed the integration test because it tried to copy New approach
This works because:
Testing
|
Issue # 36567
Closes #36567
Reason for this change
When using nodeModules with pnpm, CDK creates a
pnpm-workspace.yamlin the bundling directory (added in #21911). This causes pnpm to treat the bundling directory as a standalone workspace root, which prevents it from inheriting .npmrc configuration from parent directories. This breaks authentication for packages from private registries.Description of changes
When pnpm is detected and
nodeModulesis specified, copy the project's.npmrc(if it exists) to the bundling directory alongsidepnpm-workspace.yaml. This allows pnpm to find auth tokens for private registries.Describe any new or updated permissions being added
N/A
Description of how you validated changes
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license