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

404 error when committing changes to an organization github repo #758

Closed
MiguelAraCo opened this issue Apr 25, 2018 · 14 comments · Fixed by #4801
Closed

404 error when committing changes to an organization github repo #758

MiguelAraCo opened this issue Apr 25, 2018 · 14 comments · Fixed by #4801
Labels

Comments

@MiguelAraCo
Copy link

MiguelAraCo commented Apr 25, 2018

Steps to reproduce:

  • Create a sandbox based on a Github organization's repository (public)
  • Make some changes
  • Fill commit form
  • Hit "Commit"

Expected behavior

Loading modal appears and after a couple of seconds confirms that the commit was successful (or not).

Actual behavior

  • Loading modal appears ("Creating commit...")
  • Toast appears saying: "Request failed with status code 404"
  • Modal doesn't disappear
  • The commit was unsuccessful

Debug information

  • The sandbox was previously saved
  • The github account I'm using in codesandbox.io is part of the organization and has write access to the linked repository (including its branch)

Network request:

  • The POST request done by codesandbox.io receives the following response:

    Status: 422
    {"errors":{"detail":["Request failed with status code 404"]}}
    
@CompuIves
Copy link
Member

This could be related to the merge of (#711) today, but I'm not able to reproduce this issue locally.

What I'm doing is:

  1. Open https://codesandbox.io/s/github/CompuIves/codesandbox-test-git-app
  2. Create fork
  3. Make changes
  4. Create commit using only subject message

That worked for me. Could you maybe send the (redacted) request body/url? Maybe we are missing a case.

@MiguelAraCo
Copy link
Author

MiguelAraCo commented Apr 26, 2018

Maybe the difference is that the fork you are creating is tied to a sandbox linked to a personal repository and in my case the sandbox is linked to an organization repository.

Here's the info of the request/response info:

Request:

:authority: codesandbox.io
:method: POST
:path: /api/v1/sandboxes/q3rrrp2rl4/git/commit
:scheme: https
accept: application/json
accept-encoding: gzip, deflate, br
accept-language: es-419,es;q=0.9,en;q=0.8
authorization: #########
content-length: 57
content-type: application/json; charset=UTF-8
cookie: #########
origin: https://codesandbox.io
referer: https://codesandbox.io/s/q3rrrp2rl4
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

{"id":"q3rrrp2rl4","message":"Change class attributes to className"}

Response:

HTTP/1.1 422
status: 422
date: Thu, 26 Apr 2018 15:13:24 GMT
content-type: application/json; charset=utf-8
content-length: 61
cache-control: max-age=0, private, must-revalidate
x-request-id: 8o2vhtdmh3khavnf47hd0dlec97qqq73
via: 1.1 google
alt-svc: clear
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 4119fe387bd376be-LAX

@MiguelAraCo
Copy link
Author

I don't know if the merge you referred to has already been deployed, but I just tested it again (after making a hard refresh) and it's still not working.

Still, thanks for your hard work! 😀

@MiguelAraCo
Copy link
Author

I added a description to the commit and it still gave the same error.

@CompuIves
Copy link
Member

This is super good information @MiguelAraCo, we indeed need to add an extra check whether the user is part of the given organization. I'll give a closer look at it this week.

@MiguelAraCo
Copy link
Author

MiguelAraCo commented May 14, 2018

Any update on this? 👀

Is it something that can be fixed on the open source part of the codesandbox codebase? If so, if you could point me on the right direction, I may be able to contribute with a PR :).

@luisherranz
Copy link

I'm having the same problem :(

@vitkon
Copy link

vitkon commented Oct 5, 2018

I'm able to commit to my personal repo, unable to commit to my organization.
So there's definitely some check missing.

@vitkon
Copy link

vitkon commented Oct 5, 2018

@CompuIves , happy to help with this issue, but I assume it's a check on the server. Do you have it open-sourced?

@vitkon
Copy link

vitkon commented Oct 26, 2018

Any update on this one, guys?

@OlivierJM
Copy link

I am still having the same issue, it works for a personal account but not for an organization even when you are the owner of the organization.

@bitpod-io
Copy link

bitpod-io commented Aug 20, 2020

We are facing a similar issue. Our sandbox is https://codesandbox.io/s/charming-tu-qqwnk. Every commit fails with the status 422 and the response has JSON message

{"errors":{"detail":["Not Found"]}}

This is frustrating.

@christianalfoni
Copy link
Contributor

Hi there and sorry for not being as responsive as we want on this.

It turns out that all you need is to give access.

  1. Go to your settings on Github and open applications
    Screenshot 2020-09-01 at 13 49 06

  2. Click the third tab "Authorized OAuth apps" and Codesandbox
    Screenshot 2020-09-01 at 13 49 15

  3. Grant organization access
    Screenshot 2020-09-01 at 13 49 23

Note! it can take a few minutes for this to trigger.

@christianalfoni
Copy link
Contributor

Btw, we are improving the experience here with: #4801 , also updating the docs with information on the issue above 😄

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

Successfully merging a pull request may close this issue.

7 participants