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

JSR package install not working on StackBlitz #843

Open
birkskyum opened this issue Nov 22, 2024 · 1 comment
Open

JSR package install not working on StackBlitz #843

birkskyum opened this issue Nov 22, 2024 · 1 comment

Comments

@birkskyum
Copy link

birkskyum commented Nov 22, 2024

I'd like to be able to install packages from the jsr.io registry

Steps to Reproduce

  • Open new StackBlitz vanilla typescript project on stackblitz
  • Try to install package npx jsr add @birkskyum/maplibre-gl-draw
  • Crash
~/projects/vitejs-vite-fdprwd 1m 17s
❯ npx jsr add @birkskyum/maplibre-gl-draw
Installing @birkskyum/maplibre-gl-draw...
$ npm install @birkskyum/maplibre-gl-draw@npm:@jsr/birkskyum__maplibre-gl-draw
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://npm.jsr.io/@jsr%2fbirkskyum__maplibre-gl-draw failed, reason: socket hang up
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in: /home/.npm/_logs/2024-11-22T00_17_43_503Z-debug-0.log
Child process exited with: 1

I don't know if this is issue with JSR or StackBlitz

@brc-dd
Copy link

brc-dd commented Nov 30, 2024

Seeing these logs on console:

Access to fetch at 'https://npm.jsr.io/@jsr%2fstd__encoding' from origin 'https://nodefhfwa8-y4rq.w-credentialless-staticblitz.com' has been blocked by CORS policy: Request header field npm-command is not allowed by Access-Control-Allow-Headers in preflight response.

Probably JSR can add Access-Control-Allow-Headers: *? (Adding these from ModHeader seems to resolve the issue.)

If you want restrictive list, these are the headers that npm sets:

"pacote-version", "pacote-req-type", "pacote-pkg-id", "npm-auth-type", "npm-scope", "npm-session", "npm-command", "npm-otp"

(I think npm-scope and npm-otp will never be set in jsr add requests)

https://github.com/jsr-io/jsr/blob/main/terraform/https.tf will need updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage
Development

No branches or pull requests

2 participants