microsoft / microsoft/aspire

`aspire deploy` doesn't support npm authentication for private feeds

Open
#14,529 11 comments 0 reactions 1 assignee Claimed by @eerhardt View on GitHub
area-integrations javascript
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Similar to https://github.com/dotnet/aspire/issues/9350 but for npm. The odd thing is, similar to https://github.com/dotnet/aspire/issues/14528, running locally with `aspire run` doesn't have this problem. I'm guessing due to some locally installed credential providers helping out?

### Expected Behavior

`aspire deploy` should support a way to authenticate to private feeds defined in .npmrc when running inside ADO pipelines

### Steps To Reproduce

you can use something as simple as one of the sample applications for aspire that has backend & frontend. Just update the frontend project to have an .npmrc that uses a private feed and then use a package from that feed. You'll get 401 errors when it tries to pull the package.

The workaround for this:
``` yml
# Setup npm authentication for Docker build
Write-Host "`nSetting up npm authentication for Azure Artifacts..."
$base64Password = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$env:SYSTEM_ACCESSTOKEN"))
$npmrcContent = "registry=https://pkgs.dev.azure.com/OurProject/_packaging/OurFeed/npm/registry/`nalways-auth=true`n//pkgs.dev.azure.com/OurProject/_packaging/OurFeed/npm/registry/:username=AzureDevOps`n//pkgs.dev.azure.com/OurProject/_packaging/OurFeed/npm/registry/:_password=$base64Password`n//pkgs.dev.azure.com/OurProject/_packaging/OurFeed/npm/registry/:email=notused@example.com"
Set-Content -Path "Frontend/.npmrc" -Value $npmrcContent -Force
```

### Exceptions (if any)

_No response_

### .NET Version info

10

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.