Apollo-server: Federation Gateway cannot find schema in managed mode

Created on 2 Feb 2020  路  2Comments  路  Source: apollographql/apollo-server

Hi all,

I am simply trying to start the Apollo Gateway in the managed mode. I pushed my schema to the Graph Manager using the CLI and now try to connect via the ENGINE_API_KEY... My code is more or less just

const server = new ApolloServer({
    gateway,
    subscriptions: false,
    engine: {
        apiKey: 'service:....:.....'
    },
    context: ({ req }): HeaderContext => ({ headers: req.headers })
});

The problem I get is:

[WARN] Sun Feb 02 2020 23:15:43 GMT+0100 (Central European Standard Time) apollo-gateway: Error checking for schema updates. Falling back to existing schema. Error: CachedFetcher: Could not fetch <?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message><Details>Anonymous caller does not have storage.objects.get access to engine-partial-schema-prod/SOME_SECRET.../current/v1/composition-config-link.</Details></Error>
    at CachedFetcher.<anonymous> (/home/mmu/git/mp-apolloalpaca/service/server/node_modules/@apollo/gateway/src/cachedFetcher.ts:53:13)
    at Generator.next (<anonymous>)
    at fulfilled (/home/mmu/git/mp-apolloalpaca/service/server/node_modules/@apollo/gateway/dist/cachedFetcher.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[INFO] Sun Feb 02 2020 23:15:43 GMT+0100 (Central European Standard Time) apollo-gateway: Gateway successfully loaded schema.
        * Mode: managed
        * Service: ...
(node:15276) UnhandledPromiseRejectionWarning: Error: Expected undefined to be a GraphQL schema.
...

I also debugged this. It connects to GCP using the hashed API key and downloads a secret JSON (this works), but then it tries to download a link file under https://storage.googleapis.com/engine-partial-schema-prod/SECRET..../current/v1/composition-config-link which fails. Is this a misconfiguration of Apollo at Google Storage or am I doing something wrong ?

Cheers

Most helpful comment

Allright, found the Solution by myself. For anyone stumbling over that same problem: my Mistake was that I pushed my Schema to the Graph Manager via the apollo-cli WITHOUT a serviceName specified.

If I added that like apollo-cli service:push --serviceName=myservice ... then it worked smoothly. The Exception occurring here is quite unhelpful though.

All 2 comments

Allright, found the Solution by myself. For anyone stumbling over that same problem: my Mistake was that I pushed my Schema to the Graph Manager via the apollo-cli WITHOUT a serviceName specified.

If I added that like apollo-cli service:push --serviceName=myservice ... then it worked smoothly. The Exception occurring here is quite unhelpful though.

Having the same issue. Should this need to be set if apollo.config.js is set?

Was this page helpful?
0 / 5 - 0 ratings