Repository navigation
gh gist edit <gist-url> command not working successfully with HTTP status code 422 #7630
Description
Activity
Looks like
gist editcommand is sending a POST request:Line 329 in d46f47e
err = apiClient.REST(hostname, "POST", path, requestBody, &result) but the API docs say that the edit should be a PATCH: https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#update-a-gist
Not sure if the API changed or why there was a difference in the first place.
This is reproducible for me, and it doesn't seem to be a change on our end since this is reproducible several versions back:
➜ cli git:(v2.25.0) ✗ EDITOR=lvim ~/workspace/cli/bin/gh gist edit https://gist.github.com/williammartin/c7970e50dcd30139d6b7434714ee79a5 HTTP 422: Invalid request. (https://api.github.com/gists/c7970e50dcd30139d6b7434714ee79a5) "public", "updated_at" are not permitted keys. "type" is not a permitted key.
It seems likely that this is a platform change so I'm going to add that label and begin investigating.
but the API docs say that the edit should be a PATCH: https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#update-a-gist
That's a good callout. I checked internally and this endpoint is actually implemented for both
POSTandPATCHso I guess it has always worked and that's a bit of a red herring.Reacted by Alex Petrov- addedplatformProblems with the GitHub platform rather than the CLI clientProblems with the GitHub platform rather than the CLI client
on Jun 27, 2023 I can confirm that there was a platform change deployed yesterday that modified the schema to disallow additional properties.
I am discussing with the team that own this endpoint whether it is possible to roll back at least until we've had some time to release a change that doesn't send these additional properties and for people to adopt it.
Hi, I landed here through a Google search, and can confirm I also see this error on our end with:
"public" is not a permitted keyI am using the REST API with PATCH. The request data is in a json format, and in the top level there is this attribute:
"public": "true",This has been working for a while, and it started failing at the 26th around 15h UTC. Thanks for looking into this @williammartin !
- addedpriority-1Affects a large population and inhibits workAffects a large population and inhibits workand removedneeds-triageneeds to be reviewedneeds to be reviewed
on Jun 27, 2023 @Petesta @alex-petrov-vt @bruno-kakele
A deployment has just gone out which should revert this breaking change. Can you please confirm on your end?
➜ cli git:(trunk) ✗ EDITOR=nvim ~/workspace/cli/bin/gh gist edit https://gist.github.com/williammartin/c7970e50dcd30139d6b7434714ee79a5 ➜ cli git:(trunk) ✗ echo $? 0
Reacted by Bruno and Pete Cruz@williammartin Yep, looks like that fixed it on my end. Thank you!
Reacted by William MartinI've tentatively opened #7635 to allow the API team to move forward more safely with this change at some point in the future if they want.
In the mean time I'll keep this open until tomorrow in case anyone else wants to share, and if I don't hear anything then I will close it.
Thank you all for your contribution to this issue. Although it's not ideal for your CLI experience to be broken, your involvement in the community helped us catch this breaking change and get it fixed relatively quickly. 🙏
Reacted by Alex Petrov, Bruno and Abraham WilliamsAs I haven't heard back from anyone, closing this is as resolved.
Reacted by Bruno and Pete Cruz@williammartin There’s been a lot going on and thank you for resolving this.
Reacted by William Martin
Describe the bug
A clear and concise description of what the bug is. Include version by typing
gh --version.When running
gh --versionI have the following output.Steps to reproduce the behavior
gh gist edit <gist-url>orgh gist edit <gist-url> --filename <filename>Expected vs actual behavior
I expect this to work successfully when editing a gist. I recently installed
ghyesterday and it was working successfully then too.I've confirmed I have a valid access token and created a new one too. I can create gists from the command line with
gh gist create <filename>and run other commands successfully.My value for
EDITORisvim.