Runtime.UnhandledPromiseRejection, Error: called start() with surprising state invoking serverWillStart
See original GitHub issueThis is a very strange behavior indeed. We just started seeing this in our GQL stack this morning. I’ve reset out development environment to our stable branch to ensure that this is not related to a recent code change we have made, but the problem persists. I have been unable to find the source of this issue, and has left me quite befuddled.
{
"errorType": "Runtime.UnhandledPromiseRejection",
"errorMessage": "Error: called start() with surprising state invoking serverWillStart",
"reason": {
"errorType": "Error",
"errorMessage": "called start() with surprising state invoking serverWillStart",
"stack": [
"Error: called start() with surprising state invoking serverWillStart",
" at ApolloServer.<anonymous> (/var/task/node_modules/apollo-server-core/dist/ApolloServer.js:230:23)",
" at Generator.next (<anonymous>)",
" at /var/task/node_modules/apollo-server-core/dist/ApolloServer.js:8:71",
" at new Promise (<anonymous>)",
" at __awaiter (/var/task/node_modules/apollo-server-core/dist/ApolloServer.js:4:12)",
" at ApolloServer._start (/var/task/node_modules/apollo-server-core/dist/ApolloServer.js:226:16)",
" at ApolloServer.<anonymous> (/var/task/node_modules/apollo-server-core/dist/ApolloServer.js:280:22)",
" at Generator.next (<anonymous>)",
" at /var/task/node_modules/apollo-server-core/dist/ApolloServer.js:8:71",
" at new Promise (<anonymous>)"
]
},
"promise": {},
"stack": [
"Runtime.UnhandledPromiseRejection: Error: called start() with surprising state invoking serverWillStart",
" at process.on (/var/runtime/index.js:37:15)",
" at process.emit (events.js:203:15)",
" at process.EventEmitter.emit (domain.js:448:20)",
" at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)",
" at process._tickCallback (internal/process/next_tick.js:69:34)"
]
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:17 (9 by maintainers)
Top Results From Across the Web
Migrating to Apollo Server 4 - Apollo GraphQL Docs
start() method, before validating that the server has started by calling server.assertStarted() . context initialization function. In Apollo Server 3, you could ...
Read more >apollo-server-core - UNPKG
508, initialState.phase !== 'initialized with schema'. 509, ) {. 510, throw new Error(. 511, `called start() with surprising state ${initialState.phase}`,.
Read more >WhatsNew 1.3 | Ktor Framework
Ktor client raises "ClosedSelectorException" instead of proper error.
Read more >apollo-server-errors | Yarn - Package Manager
Note that to ensure you're using the appropriate version of apollo-server-env with apollo-datasource-rest , you need to be using v3.5.1 of that package....
Read more >connect ECONNREFUSED 172.16.1.12:27017 Code Example
log error === connect ECONNREFUSED 127.0.0.1:27017 ... This happened probably because the MongoDB service isn't started. ... The server will start.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi also got this problem using
apollo-server-micro
insider a nextjs fullstack app, I solved it by just storing theserver.start()
function in a constant like thisconst startServer = server.start()
and then using it inside the default export of the cors function@dep-dt Ah, you didn’t mention in the first message that you’re using Lambda. Yeah, combining
apollo-server-core
v2.22.0 or v2.22.1 with olderapollo-server-lambda
was definitely 100% unusable. v2.22.2 should fix this (as should upgradingapollo-server-lambda
).