Skip to content
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

(aws-lambda-nodejs): bun depenedencies fail with error: lockfile had changes, but lockfile is frozen #32906

Open
1 task
blimmer opened this issue Jan 14, 2025 · 2 comments · May be fixed by #32908
Open
1 task
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@blimmer
Copy link
Contributor

blimmer commented Jan 14, 2025

Describe the bug

When a bun lockfile contains additional entries compared to what's installed in the docker container at bundling time, the bundling fails with this error:

error: lockfile had changes, but lockfile is frozen
note: try re-running without --frozen-lockfile and commit the updated lockfile

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

N/A - this is new behavior I implemented against #31753

Expected Behavior

I expect changes to the lockfile to be allowed and the synth to pass.

Current Behavior

error: lockfile had changes, but lockfile is frozen
note: try re-running without --frozen-lockfile and commit the updated lockfile

Reproduction Steps

See blimmer/cdk-bug-reports#3 for a working repro case.

Possible Solution

We need to not enforce --frozen-lockfile, like we do for other package managers:

case LockFile.YARN:
return new PackageManager({
lockFile: LockFile.YARN,
installCommand: logLevel && logLevel !== LogLevel.INFO ? ['yarn', 'install', '--no-immutable', '--silent'] : ['yarn', 'install', '--no-immutable'],
runCommand: ['yarn', 'run'],
});
case LockFile.PNPM:
return new PackageManager({
lockFile: LockFile.PNPM,
installCommand: logLevel && logLevel !== LogLevel.INFO ? ['pnpm', 'install', '--reporter', 'silent', '--config.node-linker=hoisted', '--config.package-import-method=clone-or-copy', '--no-prefer-frozen-lockfile'] : ['pnpm', 'install', '--config.node-linker=hoisted', '--config.package-import-method=clone-or-copy', '--no-prefer-frozen-lockfile'],
// --config.node-linker=hoisted to create flat node_modules without symlinks
// --config.package-import-method=clone-or-copy to avoid hardlinking packages from the store
// --no-prefer-frozen-lockfile (works the same as yarn's --no-immutable) Disable --frozen-lockfile that is enabled by default in CI environments (https://github.com/pnpm/pnpm/issues/1994).
runCommand: ['pnpm', 'exec'],
argsSeparator: '--',
});

Additional Information/Context

No response

CDK CLI Version

2.175.1

Framework Version

No response

Node.js Version

22 LTS

OS

MacOS

Language

TypeScript

Language Version

No response

Other information

No response

@pahud
Copy link
Contributor

pahud commented Jan 14, 2025

Thank you. We'll review the PR when it's ready.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 14, 2025
@pahud pahud removed their assignment Jan 14, 2025
@blimmer
Copy link
Contributor Author

blimmer commented Jan 14, 2025

@pahud the PR is ready for review now: #32908

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants