Skip to content

fetching client ip via context request #1530

Answered by ardatan
ethdev279 asked this question in Q&A

You must be logged in to vote

In GraphQL Yoga. request object is a Request not Node's IncomingMessage so it doesn't have connection or socket but it has headers which is not a key-value object but more like a Map which is a Headers with get and set methods.

If you really want to access Node's IncomingMessage, you can get it from context.req instead of context.request which is available only in @graphql-yoga/node & Node.js environment.

See here to learn more about Yoga's context object;
https://www.graphql-yoga.com/docs/features/context

Replies: 1 comment 2 replies

You must be logged in to vote
2 replies
@ethdev279

@Urigo

Urigo Aug 6, 2022
Collaborator

Answer selected by ardatan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants