diff --git a/src/server.ts b/src/server.ts index b0d76c23..2dca782b 100644 --- a/src/server.ts +++ b/src/server.ts @@ -91,7 +91,9 @@ export interface ServerOptions { ctx: Context, message: SubscribeMessage, args: ExecutionArgs, - ) => GraphQLExecutionContextValue); + ) => + | Promise + | GraphQLExecutionContextValue); /** * The GraphQL root fields or resolvers to go * alongside the schema. Learn more about them @@ -641,7 +643,7 @@ export function createServer( if (!('contextValue' in execArgs)) { execArgs.contextValue = typeof context === 'function' - ? context(ctx, message, execArgs) + ? await context(ctx, message, execArgs) : context; }