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

"Error initializing Apollo GraphQL project" when behind a proxy #75

Open
arnaudNYC opened this issue Jun 1, 2022 · 0 comments
Open

Comments

@arnaudNYC
Copy link

arnaudNYC commented Jun 1, 2022

Hello,

When behind a corporate proxy, the extensions fails at startup with this error message:

[Network Error]: FetchError: request to https://graphql.api.apollographql.com/api/graphql failed, reason: connect ETIMEDOUT 
ApolloError: request to https://graphql.api.apollographql.com/api/graphql failed, reason: connect ETIMEDOUT 

Same project works just fine when not behind the proxy.

Things I've tried:

  • In vscode, changing values for the following settings:
    Setting http.proxy to the proxy value
    Enabling and disabling http.proxyAuthorization
    Enabling and disabling http.proxyStrictSSL
    Setting http.proxySupport to 'on'
  • In the .env file, setting the following values:
    http_proxy
    https_proxy
    HTTP_PROXY
    HTTPS_PROXY
    GLOBAL_AGENT_HTTPS_PROXY
    global_agent_https_proxy
  • Setting the following environment variables:
    http_proxy
    https_proxy
    HTTP_PROXY
    HTTPS_PROXY
    GLOBAL_AGENT_HTTPS_PROXY
    global_agent_https_proxy

Looking at the code, I couldn't find any evidence of proxies being supported, libraries like https-proxy-agent or global-agent are not being used.

The only way I could get the proxy to work was by hacking direct access to my proxy in src/env/fetch/fetch.ts:

const agent = new (HttpsProxyAgent as any)("http://proxy.company.com:8080");
function proxyFetch(url: RequestInfo, options: RequestInit | undefined) {
  return fetch(url, {
    ...options,
    agent,
  });
}

export { proxyFetch as fetch };

export {
  Request,
  Response,
  Headers,
  ResponseInit,
  BodyInit,
  RequestInfo,
  HeadersInit,
  Body,
  RequestInit,
  RequestMode,
  RequestCredentials,
  RequestCache,
  RequestRedirect,
} from "node-fetch";

Once I've done that, then the Apollo GraphQL status shows the schema as loaded.

Is there a setting, in vscode, the extension or in my environment that I am missing in order to use the extension behind a corporate proxy, or is it simply not supported?

┆Issue is synchronized with this Jira Task by Unito

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