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 codeartifact login --tool npm fails with "This command does not support workspaces." #8555

Open
jfly opened this issue Feb 29, 2024 · 2 comments
Labels
bug This issue is a bug. codeartifact login customization Issues related to CLI customizations (located in /awscli/customizations) p2 This is a standard priority issue

Comments

@jfly
Copy link

jfly commented Feb 29, 2024

Describe the bug

I cannot run aws codeartifact login --tool npm when inside of a npm workspace. The command fails with "This command does not support workspaces". See the "Reproduction Steps" below for more details.

Expected Behavior

I expect to be able to run this command anywhere and have it behave the same (that is, update my ~/.npmrc file).

Current Behavior

See the "Reproduction Steps" below for an example of how to repro with the errors inline.

Reproduction Steps

To reproduce, create a simple npm workspace and cd into it. I've created a dead simple repo for this:

$ git clone https://github.com/jfly/simple-npm-workspace.git
$ cd simple-npm-workspace/workspace-a

And here's a (redacted) aws codeartifact login command that fails:

$ aws codeartifact login --domain ... --repository ... --domain-owner ... --region ... --tool npm --namespace=...
Command '['npm', 'config', 'set', '...:registry', '...']' returned non-zero exit status 1. Stderr from command:
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

npm ERR! A complete log of this run can be found in: /home/jeremy/.npm/_logs/2024-02-29T19_52_57_750Z-debug-0.log

Or, here's a simpler command that is not redacted:

$ npm config set @foo:registry https://example.com
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

npm ERR! A complete log of this run can be found in: /home/jeremy/.npm/_logs/2024-02-29T19_54_42_376Z-debug-0.log

Possible Solution

This is arguably a bug with npm itself, and it's already filed upstream in npm/cli#6099. I can't tell if they're interested in fixing this, though. There is a workaround described here, which would be easy to port to the relevant calls to npm config set in aws-cli.

I'd be happy to send in a PR implementing this workaround if you're open to it.

Additional Information/Context

No response

CLI version used

2.15.24

Environment details (OS name and version, etc.)

Linux (NixOS unstable)

@jfly jfly added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 29, 2024
@mariecreel
Copy link

I can replicate this issue with aws-cli/2.13.28, npm/10.2.2. This isn't surfaced as a potential issue on https://aws.amazon.com/blogs/devops/publishing-private-npm-packages-aws-codeartifact/ which seems like a miss.

@tim-finnigan tim-finnigan self-assigned this May 8, 2024
@tim-finnigan tim-finnigan added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label May 8, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reporting this issue and your patience here. I will go ahead and reach out to the CodeArtifact team about the issue as they maintain this customization.

@tim-finnigan tim-finnigan added codeartifact login customization Issues related to CLI customizations (located in /awscli/customizations) p2 This is a standard priority issue and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels May 8, 2024
@tim-finnigan tim-finnigan removed their assignment May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. codeartifact login customization Issues related to CLI customizations (located in /awscli/customizations) p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants