Intended outcome
Returning a promise in the method willSendResponse of an extension should be supported
Actual outcome
If the method willSendResponse returns a promise or is async the server crashes on every calls and the client receives the errors: [{"message": "Cannot read property 'errors' of undefined"}]
How to reproduce the issue
Create a simple logging extension for an Apollo server 2:
const apolloServer = new ApolloServer({
//...
extensions: [ () => new Logger(), ],
})
And the logger:
export class Logger {
async willSendResponse() {
//...
}
}
I'm assuming this is unintended and this sould be an easy fix ;)
Intended outcome
Returning a promise in the method
willSendResponseof an extension should be supportedActual outcome
If the method
willSendResponsereturns a promise or isasyncthe server crashes on every calls and the client receives the errors:[{"message": "Cannot read property 'errors' of undefined"}]How to reproduce the issue
Create a simple logging extension for an Apollo server 2:
And the logger:
I'm assuming this is unintended and this sould be an easy fix ;)