-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Apollo Gateway Error: Expected undefined to be a GraphQL schema. #3480
Comments
I'm also having the same issue. I've tried setting the parameter
upon the federated service becoming available, the gateway still continues to throw |
@yuzhenmi : Agree. And on a side note, experimental_polling is not recommended for production environment. And there is no off-the-shelf solution for 'HotReload' of schema at the gateway level unless you go with Apollo Graph Manager which provides schema registry that has some builtin webhooks that trigger hot reload of schema. |
I'm having the exact same issue. Cannot figure out how to handle the error, but this makes it difficult to deploy to production. If the gateway comes up before any of the federated services come up this error pops up and I need to restart the gateway. Is this expected behavior? That the gateway will never be able to start unless all the federated services are healthy? |
We have this error and we are using managed apollo federation (the graph manager) |
@rvtarig7 Interesting mention of webhooks. I guess one can implement similar webhooks as a custom temporary solution until this is addressed. I imagine it won't be that difficult to do this over HTTP, key-value store or some form of a messaging system. |
Thanks for opening this originally. This should be fixed by a30bee7 in #3811, along with d8c682b from that same PR. This should be available to try on the
Please report back if this doesn't resolve your problem! |
Platform: NodeJS
Versions:
"@apollo/gateway": "0.10.7",
"apollo-server-express": "2.9.6",
"graphql": "14.5.8"
What is the issue ?
When there are no federated services running and if we try to start the apollo gateway it throws unhandled promise rejection error and is repeatedly flooding the console out with error messages.
Issue Reference :
Encountered error when loading app at http://localhost:5000/graphql: request to http://localhost:5000/graphql failed, reason: connect ECONNREFUSED 127.0.0.1:5000
(node:19144) UnhandledPromiseRejectionWarning: Error: Expected undefined to be a GraphQL schema.
at assertSchema (C:\Users\gateway-app\dist\server.js:346559:11)
at validateSchema (C:\Users\gateway-app\dist\server.js:346874:64)
at assertValidSchema (C:\Users\gateway-app\dist\server.js:346897:16)
at assertValidExecutionArguments (C:\Users\gateway-app\dist\server.js:337948:76)
at executeImpl (C:\gateway-app\dist\server.js:337898:3)
at Module.execute (C:\Users\gateway-app\dist\server.js:337876:63)
at Object.generateSchemaHash (C:\Users\gateway-app\dist\server.js:307665:32)
at ApolloServer.generateSchemaDerivedData (C:\Users\gateway-app\dist\server.js:306390:41)
at ApolloServerBase.schemaDerivedData._schema.then.schema (C:\Users\gateway-app\dist\server.js:306317:66)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:19144) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting
a promise which was not handled with .catch(). (rejection id: 4)
(node:19144) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Repeated Flooding of error messages of this type -
Error: Expected undefined to be a GraphQL schema.
at assertSchema (C:\Users\gateway-app\dist\server.js:346559:11)
at validateSchema (C:\Users\gateway-app\dist\server.js:346874:64)
at assertValidSchema (C:\Users\gateway-app\dist\server.js:346897:16)
at assertValidExecutionArguments (C:\Users\gateway-app\dist\server.js:337948:76)
at executeImpl (C:\Users\gateway-app\dist\server.js:337898:3)
at Module.execute (C:\Users\gateway-app\dist\server.js:337876:63)
at Object.generateSchemaHash (C:\Users\gateway-app\dist\server.js:307665:32)
at ApolloServer.generateSchemaDerivedData (C:\Users\gateway-app\dist\server.js:306390:41)
at ApolloServerBase.schemaDerivedData._schema.then.schema (C:\Users\gateway-app\dist\server.js:306317:66)
at process._tickCallback (internal/process/next_tick.js:68:7)
Firstly, I'm unable to handle the "Unhandled promise rejection" in this scenario when none of the federated services are up and running as wrapping the entire block within try/catch still throws the promise rejection error.
Secondly, why do we see the aforementioned error messages being printed repeatedly for every tick ? Does the gateway continue to fetch schema repeatedly from each federated service in the service list if the service is down ?
Is there a graceful way to recover the gateway if none of the federated services are available at the time the gateway starts ?
The text was updated successfully, but these errors were encountered: