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

500 errors with "cannot read request body" #522

Closed
nunoo opened this issue Jul 24, 2024 · 2 comments · Fixed by #542
Closed

500 errors with "cannot read request body" #522

nunoo opened this issue Jul 24, 2024 · 2 comments · Fixed by #542
Labels
question Further information is requested

Comments

@nunoo
Copy link
Contributor

nunoo commented Jul 24, 2024

We're getting 500 errors with cannot read request body, which seems to come from this line. I'm unable to recreate this on demand currently, so not sure if its a weird client request coming through or some other issue. I am surprised to see no err check for io.EOF though so wondering if its that? If not, have you seen these types of issues, and know what might cause them? We're logging the returned error, and it looks somewhat empty:

errors: [
   0: {}
]
level: "ERROR"
message: "cannot read request body"
msg: "returning error"

We're using humago adapter

@danielgtaylor danielgtaylor added the question Further information is requested label Jul 26, 2024
@danielgtaylor
Copy link
Owner

@nunoo sorry I have not run into this. We mainly use the humachi adapter, but underneath the hood it uses the same underlying standard library HTTP functionality. I don't think you need to check for io.EOF as described in the docs for io.Copy:

A successful Copy returns err == nil, not err == EOF. Because Copy is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported.

Happy to dig in more if you can provide a way to repro, but at this point I don't know how to debug this unfortunately.

@jonandernovella
Copy link

We spotted EOF and errors related to data corruption when consuming the raw body of huma inputs. See the issue here: #467

I think this might be related @danielgtaylor

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

Successfully merging a pull request may close this issue.

3 participants