5

I am trying to run apollo gateway locally using the managed configuration from apollo's managed solution. It loads the schema and everything is fine but when I try a query in the playground I get 'Only HTTP(S) protocols are supported'. I know I can use a serviceList but I would like to be able to run this locally for a POC with apollo graph manager. It seems to be an issue with node-fetch that apollo uses as it does not make even call the underlying datasources and fails at the gateway.

enter image description here

/* istanbul ignore file */
import {ApolloServer} from 'apollo-server';

import {ApolloGateway} from '@apollo/gateway';

 const {
   NODE_ENV,
 } = process.env;


 const gateway: ApolloGateway = new ApolloGateway();

 const main = async () => {
    return new ApolloServer({
        gateway,
        playground: NODE_ENV !== 'production',
        subscriptions: false,
 });
}

export default main;

I have searched everywhere online and can't seem to find an an answer so any help would be greatly appreciated. Any ideas how to get this working locally? Thanks in advance.

Niall
  • 804
  • 10
  • 27

1 Answers1

0

It's most likely an issue with the endpoint string you've defined for this cms service.

If you set up a data loader that queries "www.example.com/api" it will throw this error, you need to have it be "https://www.example.com/api" or "http://www.example.com/api".

Look at how your loaders are defined and where the host name is being defined, and I bet you see that there isn't any http protocol in front of it.

Source: Just dealt with this myself.

B-Stewart
  • 677
  • 2
  • 10
  • 27