You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compatibility layer between AS4 and the gateway interface used by @apollo/gateway ignores any HTTP headers or status codes that might be set by the gateway (say, by a GraphQLDataSource).
import {ApolloServer as AS4 } from '@apollo/server';
import {startStandaloneServer} from '@apollo/server/standalone'
import { ApolloGateway, RemoteGraphQLDataSource } from '@apollo/gateway';
import { buildSubgraphSchema } from '@apollo/subgraph';
import gql from 'graphql-tag';
const subgraph3 = new AS4({ schema: buildSubgraphSchema({ typeDefs: gql`type Query{x: ID}` }) });
await startStandaloneServer(subgraph3, {listen: {port: 4343}});
const gateway = new ApolloGateway({
serviceList: [{ name: 's', url: 'http://localhost:4343/' }],
buildService({ url, name }) {
return new (class extends RemoteGraphQLDataSource {
willSendRequest( options) {
if (options.kind === 'incoming operation') {
options.incomingRequestContext.response.http.headers.set('x-foo', 'bar');
}
}
})({
url,
});
}
});
const supergraph3 = new AS4({ gateway });
await startStandaloneServer(supergraph3, {listen: {port: 4344}});
Run {x}. The equivalent AS3 code sets the x-foo header but AS4 does not.
I know how to fix this but it'll have to wait until next week.
The text was updated successfully, but these errors were encountered:
The shim layer between AS4 and Gateway (which creates an argument for
the Gateway's executor which looks like AS3's GraphQLRequestContext) did
not copy changes to response headers or HTTP status back to the real
GraphQLRequestContext. This PR makes the shimmed HTTP response object
use the real response objects as backing storage.
Fixes#7069.
…ata (#7071)
The shim layer between AS4 and Gateway (which creates an argument for
the Gateway's executor which looks like AS3's GraphQLRequestContext) did
not copy changes to response headers or HTTP status back to the real
GraphQLRequestContext. This PR makes the shimmed HTTP response object
use the real response objects as backing storage.
Fixes#7069.
The compatibility layer between AS4 and the gateway interface used by
@apollo/gateway
ignores any HTTP headers or status codes that might be set by the gateway (say, by a GraphQLDataSource).Run
{x}
. The equivalent AS3 code sets thex-foo
header but AS4 does not.I know how to fix this but it'll have to wait until next week.
The text was updated successfully, but these errors were encountered: