You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I managed to narrow it down via curl to the following header: Accept: application/vnd.github.baptiste-preview+json, application/vnd.github.nebula-preview+json. It seems like if I remove application/vnd.github.nebula-preview+json part from my headers - it works. As it is used for the visibility field as described here https://docs.github.com/en/free-pro-team@latest/rest/reference/repos, I have tried to experiment with this field and it seems to only work if I set visibility: public. It fails as described above for both private and internal - so, unable to reproduce on a free org. It might be an issue with GitHub - I am currently talking to the Enterprise support and will update here with their findings.
I have had a project run into this as well as soon as we upgraded and started using this resource. Would be interested in the fix for this awesome new resource!
To be honest I do not believe there's any issues with a resource at this point. This really looks like a GitHub API bug. I just created this ticket so that we have a place to communicate. GitHub Enterprise support still haven't got back to me even though I ping them weekly. They say they are working on reproducing the issue (it's a simple curl request, c'mon). Maybe they are awaiting for more signals from the community that it is a wide spread issue - I don't know.
Facing this as well... Can't modify the default branch for private repos. @dee-kryvenko if there is an issue you can reference folks can maybe weigh in there as well to help GH understand how wide-spread it is?
I'm talking to them via their Enterprise support plan through my employer. I don't think these tickets are public. There's no updates on this BTW.
Maybe we should look for ways to reach out to them publicly. Any ideas on what that might be?
I finally got an update from GitHub support. Seems that it is indeed a bug in the provider, though the error message returned by API is a little bit off but more on that later.
It seems like this provider currently sends the whole repository JSON as a body to the PATCH request. It turns out it supposed to only be sending fields that did changed, i.e. for github_branch_default resource particularly the request should look like the following:
I tested and this request indeed works fine, even though it includes application/vnd.github.nebula-preview+json part in the Accept header. Changing visibility field works that way too.
It seems like this provider needs to be doing a better job in terms of identifying which fields did change and be sending only that changed fields.
It seems like sending everything worked fine before, but something is different about this new visibility field and the header that enables it. It seems like a combination of application/vnd.github.nebula-preview+json presence along with unchanged visibility field in case it was either private or internal but not public in the request triggers this error, which sounds like a bug or at the very least a backward incompatible change, and the error message it returns doesn't makes any sense. I've sent two additional questions to the GitHub rep:
It seems like before introducing that visibility field along with that application/vnd.github.nebula-preview+json header - the API worked fine even when the whole mostly-unchanged repository object JSON was sent to the PATCH endpoint. Even though that behavior wasn't explicitly documented, the opposite wasn't documented either. I would imagine GitHub Terraform provider is not the only one using the API that way, so depends on the point of view it might or might not be considered a backward incompatible change. Could you clarify please what's the official GitHub stance on that, and will that be explicitly documented as not supported scenario or maybe your team would consider adding this as a new supported scenario?
The error message it returns ("The branch master was not found. Please push that ref first or create it via the Git Data API.") is definitely wrong. The branch did existed and the message didn't help at all with the troubleshooting. I don't think without this support ticket anyone would been able to figure this out, especially that the documentation doesn't say explicitly that I can't send unchanged fields back to the API. I think it definitely needs fixing.
I'll pass along their feedback when I get it, regardless now we know that the issue is on the provider side and we know what needs to be fixed.
The code for github_branch_default seems to be pretty straight forward briefly looking into it. Sounds like we just need to remove Get call before calling Edit and ad-hoc creating a body object instead. That should also probably fix #620. I might be able to send a PR fixing it shortly. But it sounded like we have more places broken that way, if so - that will not automatically fix these.
Activity
javed7891 commentedon Dec 21, 2020
I am facing this same issue & also the one mentioned in #620.
Gowiem commentedon Jan 5, 2021
I have had a project run into this as well as soon as we upgraded and started using this resource. Would be interested in the fix for this awesome new resource!
dee-kryvenko commentedon Jan 5, 2021
To be honest I do not believe there's any issues with a resource at this point. This really looks like a GitHub API bug. I just created this ticket so that we have a place to communicate. GitHub Enterprise support still haven't got back to me even though I ping them weekly. They say they are working on reproducing the issue (it's a simple curl request, c'mon). Maybe they are awaiting for more signals from the community that it is a wide spread issue - I don't know.
Gowiem commentedon Jan 5, 2021
@dee-kryvenko ah interesting. Thanks for sharing the context and good luck with hashing it out with them!
timmehhh7 commentedon Jan 19, 2021
Facing this as well... Can't modify the default branch for private repos. @dee-kryvenko if there is an issue you can reference folks can maybe weigh in there as well to help GH understand how wide-spread it is?
Thanks!
Tim
dee-kryvenko commentedon Jan 19, 2021
I'm talking to them via their Enterprise support plan through my employer. I don't think these tickets are public. There's no updates on this BTW.
Maybe we should look for ways to reach out to them publicly. Any ideas on what that might be?
dee-kryvenko commentedon Jan 21, 2021
I finally got an update from GitHub support. Seems that it is indeed a bug in the provider, though the error message returned by API is a little bit off but more on that later.
It seems like this provider currently sends the whole repository JSON as a body to the PATCH request. It turns out it supposed to only be sending fields that did changed, i.e. for
github_branch_defaultresource particularly the request should look like the following:I tested and this request indeed works fine, even though it includes
application/vnd.github.nebula-preview+jsonpart in theAcceptheader. Changingvisibilityfield works that way too.It seems like this provider needs to be doing a better job in terms of identifying which fields did change and be sending only that changed fields.
It seems like sending everything worked fine before, but something is different about this new
visibilityfield and the header that enables it. It seems like a combination ofapplication/vnd.github.nebula-preview+jsonpresence along with unchangedvisibilityfield in case it was eitherprivateorinternalbut notpublicin the request triggers this error, which sounds like a bug or at the very least a backward incompatible change, and the error message it returns doesn't makes any sense. I've sent two additional questions to the GitHub rep:I'll pass along their feedback when I get it, regardless now we know that the issue is on the provider side and we know what needs to be fixed.
The code for
github_branch_defaultseems to be pretty straight forward briefly looking into it. Sounds like we just need to removeGetcall before callingEditand ad-hoc creating a body object instead. That should also probably fix #620. I might be able to send a PR fixing it shortly. But it sounded like we have more places broken that way, if so - that will not automatically fix these.github_branch_default: send only fields that changed. Fixes integrati…
dee-kryvenko commentedon Jan 21, 2021
Alright, unless I'm missing something - that should be the fix #666
Love the 666 number of it.
dee-kryvenko commentedon Jan 21, 2021
@jcudit would you be able please to take a look?
jcudit commentedon Jan 22, 2021
Will do! Thanks for your persistence here.
Merge in upstream changes (#1)
github_branch_default: send only fields that changed. Fixes integrati…