apollographql / apollographql/apollo-tooling

Allow providing http Agent in config.client.service

Open
#1,768 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

Currently the only things we can provide `client.service` in `apollo.config.js` are url, headers, and a skip SSL flag.

We have to build out quite a few work arounds to this limited configuration because of internal requirements of security. All of these workarounds could have been avoided if the configuration would allow providing an HTTP(S) agent directly from config, such as this here: https://github.com/apollographql/apollo-tooling/blob/bedd6eafbb8c1b690102738573069effd478283f/packages/apollo-language-server/src/providers/schema/endpoint.ts#L118

Something like the following would be ideal:
```js
if (config.fetchOptions) {
options.fetchOptions = config.fetchOptions;
} else {
// ... current logic
}
```
Though this would also work:
```js
if (config.agent) {
options.fetchOptions = { agent: config.agent };
} else {
// ... current logic
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the linked endpoint.ts example and trace how client.service is read from apollo.config.js and passed into the HTTP request options. Confirm the intended configuration shape and identify the relevant existing request tests; done means an HTTP(S) agent can be supplied through config.client.service without breaking the current URL, headers, or skip-SSL behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.