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

Federation Gateway cannot find schema in managed mode #3753

Closed
mmuth opened this issue Feb 2, 2020 · 2 comments
Closed

Federation Gateway cannot find schema in managed mode #3753

mmuth opened this issue Feb 2, 2020 · 2 comments

Comments

@mmuth
Copy link

mmuth commented Feb 2, 2020

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

@mmuth
Copy link
Author

mmuth commented Feb 4, 2020

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.

@mmuth mmuth closed this as completed Feb 4, 2020
@Gadurp1
Copy link

Gadurp1 commented Jun 3, 2020

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants