codesandbox / codesandbox-client

An online IDE for rapid web development
https://codesandbox.io
Other
13.08k stars 2.28k forks source link

Error 422 - Cannot export sandbox to GitHub #5604

Open hodgef opened 3 years ago

hodgef commented 3 years ago

🐛 bug report

Preflight Checklist

Description of the problem

Cannot export sandbox to GitHub. The process fails with "No commit found for SHA: main" and the GitHub repo created under my account is empty. Tried logging out then logging back in, issue persists.

How has this issue affected you? What are you trying to accomplish?

Per above

To Reproduce

Link to sandbox: link

image image

Your Environment

Software Name/Version
Сodesandbox 2d40f51ad
Browser Edge Chromium 89
Operating System Windows 10
andrasbacsai commented 3 years ago

Can you please try it again if the issue persists?

I cannot replicate it. I forked it and published it to Github without any problem.

hodgef commented 3 years ago

Sadly, it still doesn't work on my end...

image image

Not sure why. What does the error "No commit found for SHA: main" that appears in codesandbox even means?

Regards, Francisco Hodge

LeadDreamer commented 3 years ago

Experiencing the same. I've downloaded the sandbox, and will try to use out-of-band (i.e. GitHub Desktop) to commit.

hodgef commented 3 years ago

@SaraVieira @CompuIves Could you please help us with this? I wonder if there's an issue with bug triage, since this ticket has been sitting idle for about a month now... :\

CompuIves commented 3 years ago

Could you try again? I've deployed some extra error logging and improved the errors that we return. It might work now, or at least return a descriptive error.

On Mon, Apr 19 2021 at 9:02 PM, Francisco Hodge < @.*** > wrote:

@SaraVieira ( https://github.com/SaraVieira ) @CompuIves ( https://github.com/CompuIves ) Could you please help us with this? I wonder if there's an issue with bug triage, since this ticket has been sitting idle for about a month now... :\

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub ( https://github.com/codesandbox/codesandbox-client/issues/5604#issuecomment-822703735 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAEPKCE46ZA6ASIGKPJ4OA3TJR43FANCNFSM4ZR6RYCA ).

LeadDreamer commented 3 years ago

From my perspective: I downloaded the ZIP, then used Github Desktop & VS Code to commit to github - worked successfully, and my CI/CD linkage to netlify succeeded as well. I created a new sandbox from the GitHub branch - which unfortunately took a couple tries, due to the "sandbox domain starting with a digit not compatible with Google Firestore bug" reported elsewhere. Once successfully created without the leading digit (luck), the github tab in codesanbox.io would not open until I fully closed the browser and re-started. I still have the sandbox that was presenting the error, so I will try it again, but since I did the out-of-band commit, I suspect it will have issues...

hodgef commented 3 years ago

@CompuIves Thanks for the quick response. I tried it just now, sadly same cryptic error appears:

image https://codesandbox.io/s/awesome-thunder-klb3i

Request URL: https://codesandbox.io/api/v1/sandboxes/klb3i/git/repo/simple-keyboard-test-modules
Request Method: POST
Status Code: 422 
Remote Address: 104.18.23.207:443
Referrer Policy: strict-origin-when-cross-origin

Response: 
{errors: {detail: ["No commit found for SHA: main"]}}

Following this, an empty repo is created in my Github account

image https://github.com/hodgef/simple-keyboard-test-modules

CompuIves commented 3 years ago

Oh this is super useful! It seems like it tries to create a commit on the "main" branch though the repo has only a "master" branch. I can take a closer look into this and fix it tomorrow!

On Mon, Apr 19 2021 at 9:14 PM, Francisco Hodge < @.*** > wrote:

@CompuIves ( https://github.com/CompuIves ) Here's the latest attempt, sadly same cryptic error sadly:

image ( https://user-images.githubusercontent.com/25509135/115290372-71319680-a121-11eb-880f-66061dc88980.png ) https://codesandbox.io/s/awesome-thunder-klb3i

Request URL: https://codesandbox.io/api/v1/sandboxes/klb3i/git/repo/simple-keyboard-test-modules Request Method: POST Status Code: 422 Remote Address: 104.18.23.207:443 Referrer Policy: strict-origin-when-cross-origin

Response: {errors: {detail: ["No commit found for SHA: main"]}}

Following this, an empty repo is created in my Github account

image ( https://user-images.githubusercontent.com/25509135/115290611-bf469a00-a121-11eb-8d6c-5a59c4f452fb.png ) https://github.com/hodgef/simple-keyboard-test-modules

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub ( https://github.com/codesandbox/codesandbox-client/issues/5604#issuecomment-822718672 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAEPKCEA2TEF7AEYEQTZ7MLTJR6KVANCNFSM4ZR6RYCA ).

hodgef commented 3 years ago

That would be amazing, thank you so much!

LeadDreamer commented 3 years ago

Error persists on sandbox that previously presented it; on opening sandbox get error message: "Could not load the source sandbox for this GitHub sandbox, please refresh or report the issue. No commit found for SHA: null". Error presents itself inChrome on both Windows (7) and MacOs.

Newly created sandbox from SAME branch does not seem to have the issue.

@CompuIves Do you want me to hold onto the sandbox with the issue? I can make progress on my work in the new sandbox...

lbogdan commented 3 years ago

@LeadDreamer Are you referring to one of the sandboxes linked here? If not, can you please provide a link?

lbogdan commented 3 years ago

Hey @hodgef ,

Unfortunately I can't reproduce this on my end. If it's still and issue for you, and you can consistently reproduce it, can we maybe jump on a call sometime and try to debug it in real-time?

LeadDreamer commented 3 years ago

@lbogdan Having received no answer, I did not make a particular point of holding the sandbox. A month ago, I might have been able to find a way (the repository itself is fairly proprietary), but I've had to move on quite a bit since then - the sandbox I suspect had the problem is also quite out of sync with the master, so I'm not of a mind to test on it. At this point I don't think I can help - is there another way I can reach out if the issue recurs?

hodgef commented 3 years ago

Hey @hodgef ,

Unfortunately I can't reproduce this on my end. If it's still and issue for you, and you can consistently reproduce it, can we maybe jump on a call sometime and try to debug it in real-time?

Hello @lbogdan & @CompuIves,

I can still reproduce this issue consistently using the same sandbox (https://codesandbox.io/s/awesome-thunder-klb3i?file=/src/index.js)

image

I would be open to jump on a call to debug this. Feel free to send an invite to my email, or let me know if there's any other way I can help. GitHub export was quite an useful feature so I would love to see it working again.

Regards, Francisco Hodge

lbogdan commented 3 years ago

@hodgef I tried forking your sandbox and exporting it to GitHub, and it worked fine, so it looks like it's an issue specific to that sandbox. You can find me on our Discord server, I'm BogdanL there.

johtso commented 3 years ago

@lbogdan I just stumbled on this issue myself..

Unless I'm missing something, it seems that codesandbox is just assuming that newly created repos will have a main branch, but this depends on the users settings. My default branch name is set to master so the process fails with the error message people have been sharing above.

It would seem that it just needs to check what the name of the branch is in the newly created repository?

chenxizhang commented 3 years ago

same issue here

chenxizhang commented 3 years ago

please support master branch too, not limit to use "main"

jineeshjohn commented 2 years ago

Following this comment fixed for me

arvigeus commented 2 years ago

@hodgef I tried forking your sandbox and exporting it to GitHub, and it worked fine, so it looks like it's an issue specific to that sandbox. You can find me on our Discord server, I'm BogdanL there.

Likely you haven't set "master" as a default branch on GitHub.

owenallenaz commented 1 year ago

I'm not sure how to reconcile this issue. My github is setup so that master is the default branch, and I can't change that due to issues with my environment and tooling. Attempting to create a new sandbox from my project repo fails with this error. If I pre-create an empty repo and set it up with a main branch to align with this, then it can't export because it says the repo already exists.

Edit: Solved my problem by changing my default profile, changing default to main, exporting and then changing back. Annoying I have to do so, hope ya'll can fix it.

DarkMortal commented 5 months ago

Experiencing the same. I've downloaded the sandbox, and will try to use out-of-band (i.e. GitHub Desktop) to commit.

Changing the Sandbox to public solved my issue. I can now easily export it to my GitHub Account.