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

[Bug]: update_pnpm_lock fails under Bzlmod, retry fixes it #1445

Closed
alexeagle opened this issue Jan 16, 2024 · 3 comments
Closed

[Bug]: update_pnpm_lock fails under Bzlmod, retry fixes it #1445

alexeagle opened this issue Jan 16, 2024 · 3 comments
Assignees
Labels
bug Something isn't working funding needed Contribute to https://opencollective.com/aspect-build

Comments

@alexeagle
Copy link
Member

alexeagle commented Jan 16, 2024

What happened?

Under bzlmod, update_pnpm_lock fails on the first attempt.

Version

HEAD

How to reproduce

In rules_js,

  1. cd e2e/npm_translate_lock
  2. modify package.json, like "semver": "7.5.4"

then bazel build ... gives an error:

~/Projects/rules_js/e2e/npm_translate_lock$ bazel build --enable_bzlmod ...
Starting local Bazel server and connecting to it...
ERROR: Skipping '...': error loading package under directory '': error loading package '': at /shared/cache/bazel/user_base/3b36aba3ddc6cb653f7aaaed8bb07c4d/external/aspect_rules_js~override~npm~npm/defs.bzl:40:6: Unable to find package for @aspect_rules_js~override~npm~npm__semver__registry.npmjs.org_semver_7.5.4__links//:defs.bzl: The repository '@aspect_rules_js~override~npm~npm__semver__registry.npmjs.org_semver_7.5.4__links' could not be resolved: Repository '@aspect_rules_js~override~npm~npm__semver__registry.npmjs.org_semver_7.5.4__links' is not defined.

Simply running the same bazel build command again fixes it.

Any other information?

No response

@alexeagle alexeagle added the bug Something isn't working label Jan 16, 2024
@github-actions github-actions bot added the untriaged Requires traige label Jan 16, 2024
@alexeagle
Copy link
Member Author

alexeagle commented Jan 17, 2024

Adding some print debugging shows that the module extension isn't executed the way we thought. We call npm_translate_lock but it is non-blocking, the module_ctx.read(attr.pnpm_lock) later in extensions.bzl is already evaluated before we write the changed pnpm-lock.yaml back to the disk. I think this is fixable, but I'm not exactly sure how, and anyway I don't think we have time to prioritize it right now.

@alexeagle alexeagle added funding needed Contribute to https://opencollective.com/aspect-build and removed untriaged Requires traige labels Jan 18, 2024
@alexeagle
Copy link
Member Author

Got some design feedback from the Bazel team: https://bazelbuild.slack.com/archives/C014RARENH0/p1705451482052209

@jbedard
Copy link
Member

jbedard commented May 7, 2024

Support for this has been removed (bzlmod and workspace) in 2.x: ffd4583

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working funding needed Contribute to https://opencollective.com/aspect-build
Projects
Status: Done
Development

No branches or pull requests

2 participants