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

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

Open
3 tasks
g7fernandes opened this issue Mar 10, 2023 · 1 comment
Open
3 tasks

Comments

@g7fernandes
Copy link
Member

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.

@ghost
Copy link

ghost commented Jun 26, 2023

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

No branches or pull requests

1 participant