Skip to content

Conversation

@jjbayer
Copy link
Member

@jjbayer jjbayer commented Feb 11, 2026

Follow-up to #5624 (comment)

I verified that the server indeed responds with 502. Fixed by checking the error source in ForwardError::into_response.

HttpError::Misconfigured => StatusCode::INTERNAL_SERVER_ERROR.into_response(),
},
Self::Upstream(UpstreamRequestError::SendFailed(e)) => {
if has_source::<http_body_util::LengthLimitError>(&e) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The length limit error is deeply nested:

Upstream(
        SendFailed(
            reqwest::Error {
                kind: Request,
                url: "http://127.0.0.1:56750/api/42/attachment/?sentry_key=f78f4884d0c44e9ead0c80a42e949b50",
                source: hyper_util::client::legacy::Error(
                    SendRequest,
                    hyper::Error(
                        User(
                            Body,
                        ),
                        reqwest::Error {
                            kind: Body,
                            source: Error {
                                inner: LengthLimitError,
                            },
                        },
                    ),
                ),
            },
        ),
    ),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another option with a different/wrapped middleware which makes this less tedious?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could possibly make this a little more flat, but the basic problem is that since we're now streaming, the error occurs in the reqwest library while sending the outbound request.

flate2 = { workspace = true }
futures = { workspace = true, features = ["async-await"] }
hashbrown = { workspace = true }
http-body-util = { workspace = true }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this only to be able to reference the type. The dependency was already in our tree.

Comment on lines +306 to +308
except Exception:
# stream might be invalid
pass
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the integration test crashes before we see what relay responds with.

"/api/42/store/",
"/api/42/envelope/",
"/api/666/envelope/",
"/api/42/attachment/",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this back to the original. By using /api/666/envelope/, I obscured the bug that this PR fixes.

@jjbayer jjbayer marked this pull request as ready for review February 11, 2026 11:03
@jjbayer jjbayer requested a review from a team as a code owner February 11, 2026 11:03
HttpError::Misconfigured => StatusCode::INTERNAL_SERVER_ERROR.into_response(),
},
Self::Upstream(UpstreamRequestError::SendFailed(e)) => {
if has_source::<http_body_util::LengthLimitError>(&e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another option with a different/wrapped middleware which makes this less tedious?

@jjbayer jjbayer added this pull request to the merge queue Feb 11, 2026
Merged via the queue into master with commit 5de40b6 Feb 11, 2026
34 of 47 checks passed
@jjbayer jjbayer deleted the fix/forward-413 branch February 11, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants