apollo-federation-file-upload icon indicating copy to clipboard operation
apollo-federation-file-upload copied to clipboard

Check why headers are not arriving on the RemoteGraphQLDataSource.process(args)

Open g7fernandes opened this issue 1 year ago • 1 comments

Spike/Research Request

Context

Then trying to create tests for custom headers, that can be added by implementing the RemoteGraphQLDataSource.willSendRequest(args) function, I noted that the args.request.http.header was undefined. From the examples in the documentation, one would expect that a request with any header would make request.http.header to be defined and then we could just use .set to add a custom header to be passed to the services.

Knowledge Gap

  • We don't know why the original request headers aren't available for the method willSendRequest. Is something misconfigured on the test server? Did I understand Apollo's documentation wrong?

Goals/Deliverables

  • [ ] Explain what causes the parameter of RemoteGraphQLDataSorce.willSendRequest() (the same as RemoteGraphQLDataSource.process()) to be undefined;
  • [ ] Understand how we can have the original headers on such parameters;
  • [ ] Update the test service configuration.

The type of .willSendRequest parameter is GraphQLDataSourceProcessOptions

Extra info

You can test sending any request to the test server by commenting/removing these lines

  await runTests();
  await Promise.all([
    stopDownload(),
    chunkedDownloadDownload(),
    gatewayServerStop(),
  ]);

and adding a line with console.log(gatewayService.address.port) to know the gateway on the test/index.ts file. Then run yarn test.

g7fernandes avatar Mar 10 '23 13:03 g7fernandes

resolved Check here https://stackoverflow.com/questions/70426637/how-can-i-add-2-buildservice-upload-and-header-to-apollo-federation

KMoscIszko avatar Jun 26 '23 21:06 KMoscIszko