-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Google Classroom Turn In API bad request error #1979
Comments
The Go client docs for TurnInStudentSubmissionRequest indeed show it as an empty struct. I will continue investigating. |
Instead of |
I had initially tried that too, same result. I can double check, if that's what worked for you, but i do remember the same error happening and then trying the empty struct. |
@codyoss setting the param to |
I'm on rotation now so I've looked into this. I have strong reason to believe that this is either an issue in the backend (not expecting a body when it should be) or a misconfiguration of their HTTP settings (those that ultimately serve the API and are used to generate this client library). I will open a bug internally and follow up here with y'all. |
@mattszeto I don't have a good way to test this API, can you reproduce the issue with If so, please share your findings! This will go a long way in helping us nail down the root cause. |
As a sanity check, I verified that the JSON encoder used to prepare the request body reader produces a package main
import (
"fmt"
"io"
classroom "google.golang.org/api/classroom/v1"
"google.golang.org/api/googleapi"
)
func main() {
req := &classroom.TurnInStudentSubmissionRequest{}
r, err := googleapi.WithoutDataWrapper.JSONReader(req)
if err != nil {
fmt.Println(err)
return
}
d, err := io.ReadAll(r)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("marshaled: %s\n", string(d))
} |
I was not able to reproduce the issue in the API's rest documentation or this curl:
they were both successful.
Yes, that was my first concern, but it checked out. So I am stumped. |
Thanks so much for doing that. One more favor, @mattszeto:
Could you try that but include an empty message body e.g. |
adding an empty message body produced the same
|
Thanks a bunch @mattszeto @codyoss if this isn't reproducible via cURL, there may be an issue with the client itself...hm |
I already filed a bug internally, through which I hope to get an integration test setup to repro & debug with. |
@mattszeto and @JohnsoNeal2013 was this a new behavior that has impacted some existing application? If so, when did it start happening? |
Also, Cody tested almost identical code for another API that had an empty request message and it worked just fine. That indicates the issue should be in the service. |
new implementation of this function for an existing application, which has a bunch of other google classroom functions that are working perfectly fine. |
An engineer from the service team has triaged it, but will need some time to get to it. They'll dig deeper next week. |
In the meantime you can fallback to using our transport package to create an authenticated client and manually create the request.(note you will need to pass the correct scopes) I believe if you send a nil to body on https://pkg.go.dev/net/http#NewRequest it should work. https://pkg.go.dev/google.golang.org/[email protected]/transport/http#NewClient |
Thanks guys! has there been any update on this issue? |
Sorry, not yet, but I will bump the bug! |
Got confirmation of the bug, but still not scheduled to be fixed. @mattszeto have you tried the authenticated client that Cody suggested? If so, has it worked for you? |
Have not tried that method yet. Hoping to get this issue solved so i don't have to 😅 |
@noahdietz any updates on this being work on soon? |
No updates to share as of right now. For now I would suggest the workaround above for the time being: #1979 (comment) |
Wanted to reach out again and see if there are any updates to this issue. I've made an attempt to fork and fix the issue myself, so if there is any insight to where the issue could be would be helpful.
it was mentioned here by @noahdietz that it's an issue with the service, is this the case? |
No update, the team is too busy to address it atm, I'm sorry. It's a matter of prioritization, not denial of an issue. |
One other debugging thing that might be worth doing is ensuring (via debugger or printf) that |
Still no update here, but for future Googlers internal bug is: 283810139 |
Environment details
Steps to reproduce
running this code snippet (given valid course id, coursework id and submission id...):
gives this error:
I read the docs and found no information on what
TurnInStudentSubmissionRequest
is. It seem its only purpose is to provide an empty request body. So, my assumption is to just include an empty struct, but i am left with a 400 bad request error stating above issue.Am I writing this call incorrectly?
The text was updated successfully, but these errors were encountered: