Graphql-yoga: How to access Lambda event inside resolvers?

Created on 29 Jan 2018  路  4Comments  路  Source: dotansimha/graphql-yoga

Is it possible to access the lambda event (headers, etc.) inside resolvers? Can't see an obvious way.

statupr-welcome

Most helpful comment

I've read through the source code and it looks like a function passed in as the context has access to the event. The following sets the APIGatewayEvent as context.

const context = ({ event }) => event

const lambda = new GraphQLServerLambda({ context, typeDefs, resolvers })

Maybe this is more of a documentation or defaults issue.

All 4 comments

I agree, this should certainly be possible. Probably by exposing it on the context object?

I've read through the source code and it looks like a function passed in as the context has access to the event. The following sets the APIGatewayEvent as context.

const context = ({ event }) => event

const lambda = new GraphQLServerLambda({ context, typeDefs, resolvers })

Maybe this is more of a documentation or defaults issue.

Due to inactivity of this issue we have marked it stale. It will be closed if no further activity occurs.

Hey :wave:, It seems like this issue has been inactive for some time. In need for maintaining clear overview of the issues concerning the latest version of graphql-yoga we'll close it.
Feel free to reopen it at any time if you believe we should futher discuss its content. :slightly_smiling_face:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CaptainChemist picture CaptainChemist  路  4Comments

AhmadEl-Banna picture AhmadEl-Banna  路  5Comments

yesprasad picture yesprasad  路  3Comments

checkmatez picture checkmatez  路  5Comments

bellomusodiq picture bellomusodiq  路  3Comments