webcontainer-core icon indicating copy to clipboard operation
webcontainer-core copied to clipboard

Creating a repository from stackblitz in github results in Error: failed to fetch

Open KostaDoul opened this issue 9 months ago • 11 comments

Describe the bug

Hi StackBlitz Team,

I'm experiencing a persistent issue when trying to export a project from StackBlitz to GitHub.

Problem Summary: When I click "Create a repository" or try to export to GitHub, I consistently get the error:

"failed to fetch"

Although a GitHub repository is created, it remains completely empty: No files are pushed. No main branch is created. As a result, Netlify can't connect to the repo and StackBlitz can't sync code.

What I’ve tried: Verified that StackBlitz is listed under Installed GitHub Apps and Authorized GitHub Apps. Revoked and re-authorized access via GitHub. Tried multiple browsers (Chrome, Firefox) and disabled pop-up blockers. Attempted in private/incognito mode. Tried to trigger the GitHub OAuth authorization popup, but no popup appears. Exported ZIP and tried manual upload, but my project is too large for GitHub's web uploader.

Suspected Cause: It appears that StackBlitz has GitHub App access but lacks proper OAuth authorization, preventing code from being pushed. This might be due to:

A missing or expired OAuth token. A bug in how StackBlitz initializes the GitHub connection.

Request: Could you please help me:

Re-enable OAuth authorization properly? Or confirm if this is a known issue on your end? Let me know if you need more details — I can also provide screenshots and project links if needed.

Thanks so much for your help! Best regards,

Link to the blitz that caused the error

https://stackblitz.com/edit/sb1-ugtn977i?file=index.html

Steps to reproduce

  1. Export "bolt" project wirth stackblitz.
  2. Click on "create a repository"
  3. give the repository a name.
  4. check the box to make it private.
  5. Create it.

Expected behavior

A repository in github which contains all the previous files.

Parity with Local

Screenshots

No response

Platform

Browser name  = Chrome
Full version  = 135.0.0.0
Major version = 135
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 65769785,
  "usedJSHeapSize": 64088433,
  "jsHeapSizeLimit": 4294705152
}
Hash = b14ae8b6

Additional context

No response

KostaDoul avatar Apr 09 '25 07:04 KostaDoul

Hey @KostaDoul, thanks for reaching out! Before clicking the Create Repository button, can you open your Chrome DevTools on the network tab, then click the button to create the repository. Are there any failing network requests (that might have to do with github)? If so (which I would expect), what is the error response? That information would be very valuable!

SamVerschueren avatar Apr 11 '25 09:04 SamVerschueren

Hey @SamVerschueren , thanks for the response. Maybe some context of the situation would help. I have uploaded videos on my website in bolt. After failing to create the repository i thought that maybe the file is too big for github with all the videos, so i externally hosted them. But unfortunately i still get the same error as before.

I followed your instructions and i get multiple errors. Pictures attached.

Image Image

KostaDoul avatar Apr 11 '25 09:04 KostaDoul

Can you go to the network tab and open the request to https://api.github.com/user/repos? The response of that request should tell us what the issue is because this is definitely the problem here.

SamVerschueren avatar Apr 11 '25 11:04 SamVerschueren

This are the pictures if i open this error @SamVerschueren :

Image Image

KostaDoul avatar Apr 11 '25 12:04 KostaDoul

I mean the network tab, not the console. Here are the steps

  1. In the top of the devtools, go to the tab Network
  2. There should be a filter option and type in /repos
  3. You should see the /repos in red. Click on the request.
  4. Then when you clicked it, switch the tab from Headers to Response.

Here's an example of what you should see.

Image

SamVerschueren avatar Apr 11 '25 12:04 SamVerschueren

Thanks for clarification @SamVerschueren . Done!

Image

KostaDoul avatar Apr 11 '25 12:04 KostaDoul

As the error message says

name already exists on this account

Can you try to create a repository with a different name that doesn't exist yet? I'll try it myself later as well.

SamVerschueren avatar Apr 11 '25 12:04 SamVerschueren

this happens when i use a different name @SamVerschueren the repository gets created, but is empty without files.

Image Image Image Image Image

KostaDoul avatar Apr 11 '25 13:04 KostaDoul

Hi @SamVerschueren , can you work with the my last message and the images to resolve the issue?

KostaDoul avatar Apr 14 '25 13:04 KostaDoul

Hello, can somebody help with this issue? @alexkalderimis @EricSimons @atian25 @SamVerschueren

KostaDoul avatar Apr 23 '25 09:04 KostaDoul

I brought this up internally as I'm not very familiar with that part. We are looking into issues with the github integration.

SamVerschueren avatar Apr 23 '25 09:04 SamVerschueren

Hey @SamVerschueren , hope you are doing well, have you any update?

KostaDoul avatar May 04 '25 17:05 KostaDoul