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

Unable to fetch Nuxt layer GitHub dependencies in Codeflow (CORS error) #3077

Open
MexicanAce opened this issue Jun 18, 2024 · 5 comments
Open

Comments

@MexicanAce
Copy link

Description of Bug

The zksync-docs repo uses Nuxt Layers, and more specifically references other public GitHub repos (see nuxt.config.ts file here). When opening the repo in Codeflow, the terminal will fail to run npm install and output the following error:

> npm install
[...]
> zksync-docs@0.0.0 postinstall
> nuxt prepare


[10:36:59 AM]  ERROR  Failed to download https://api.github.com/repos/matter-labs/docs-nuxt-template/tarball/main: TypeError: fetch failed

  at eval (node_modules/giget/dist/index.mjs:78:11)
  at async sendFetch (node_modules/giget/dist/index.mjs:74:15)
  [... rest of stack trace ...]

After further investigation, it looks like this is due to a CORS error:

Access to fetch at 'https://codeload.github.com/matter-labs/docs-nuxt-template/legacy.tar.gz/refs/heads/main' (redirected from 'https://api.github.com/repos/matter-labs/docs-nuxt-template/tarball/main') from origin 'https://zksyncdocs-a2ws.w-credentialless-staticblitz.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Steps to Reproduce

  1. Go to https://pr.new/github.com/matter-labs/zksync-docs
  2. Wait for npm install to automatically start and see the fetch failures

Expected Behavior

npm install successfully completes

Screenshots/Screencast

image

@samdenty
Copy link
Member

samdenty commented Jun 19, 2024

We recently added support for Cors Proxy, which may fix this issue https://blog.stackblitz.com/posts/cors-proxy/. Though because it's coming from NPM, I'm not 100% sure

@MexicanAce
Copy link
Author

@samdenty Good to know, I'm trying to use the new flag but I keep getting prompted with the following modal (I've upgraded my account today, so maybe it takes a while to reflect within the IDE?)
image

@samdenty
Copy link
Member

Cc @d3lm @Nemikolh

@MexicanAce
Copy link
Author

It's been over a week after I've upgraded my account, and I still get this popup. So doesn't look like an issue related to timing.

@kirjavascript
Copy link
Member

It's been over a week after I've upgraded my account, and I still get this popup. So doesn't look like an issue related to timing.

hi! We've looked into the issue and in the process of fixing it uncovered some other issues related to it. Once they are resolved we can deploy the fix.

It should be resolved soon!

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

No branches or pull requests

3 participants