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

Playground struggles loading packages from unpkg due to CORS sometimes #1066

Open
gka opened this issue Dec 24, 2024 · 1 comment
Open

Playground struggles loading packages from unpkg due to CORS sometimes #1066

gka opened this issue Dec 24, 2024 · 1 comment

Comments

@gka
Copy link

gka commented Dec 24, 2024

Describe the bug

Some playground demos randomly fail because a request to unpkg fails. I think this happens more often for demos with a lot of dependencies, like this one.

image

After reloading the REPL a few times I get different packages failing, seemingly randomly:

Error fetching "d3-array" from unpkg. Does the package exist?

or

Error fetching "d3-dispatch" from unpkg. Does the package exist?

Reproduction

Just open this REPL and reload the browser a few times.

Logs

I looked up the request in the browser dev tools and it seems to be related to CORS problems:

GET /d3-dispatch@latest/package.json undefined
Host: unpkg.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br, zstd
Referer: https://svelte.dev/
Origin: https://svelte.dev
DNT: 1
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
Priority: u=4
TE: trailers
Response body is not available to scripts (Reason: CORS Failed)

System Info

Firefox 133.0.3 (aarch64)

Severity

annoyance

@gka gka changed the title Playground sometimes struggles loading packages from unpkg due to CORS error Playground struggles loading packages from unpkg due to CORS sometimes Dec 24, 2024
@Conduitry Conduitry transferred this issue from sveltejs/svelte Dec 24, 2024
@Conduitry
Copy link
Member

What I think is probably more likely than certain requests randomly failing CORS is that certain requests randomly fail with 5xx/etc. errors or are dropped and that those responses never have the appropriate CORS headers.

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

No branches or pull requests

2 participants