apollographql / router

A configurable, high-performance routing runtime for Apollo Federation 🚀
https://www.apollographql.com/docs/router/
Other
774 stars 251 forks source link

Graphql requests return non-graphql responses #5171

Open BrynCooke opened 1 month ago

BrynCooke commented 1 month ago

In https://github.com/apollographql/router/blob/dev/apollo-router/src/axum_factory/axum_http_server_factory.rs#L666-L681 we are returning non-graphql errors. This should never be the case inside handle_graphql.

            if let Some(source_err) = err.source() {
                if source_err.is::<RateLimited>() {
                    return RateLimited::new().into_response();
                }
                if source_err.is::<Elapsed>() {
                    return Elapsed::new().into_response();
                }
            }
            if err.is::<RateLimited>() {
                return RateLimited::new().into_response();
            }
            if err.is::<Elapsed>() {
                return Elapsed::new().into_response();
            }

main_router should be checked that if will also never return an error in itself therefore returning a non-graphql error. I don't think that it does, but this needs valdiation.

abernix commented 3 weeks ago

This was partially fixed by #5159, but there are still some remaining things to be looked at.