Skip to content

aspire deploy doesn't support npm authentication for private feeds #14529

@tekgiant

Description

@tekgiant

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Similar to #9350 but for npm. The odd thing is, similar to #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:

# 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

Metadata

Metadata

Assignees

Labels

area-integrationsIssues pertaining to Aspire Integrations packagesjavascriptPull requests that update Javascript code

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions