-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to log request data (ip address) #1506
Comments
Same issue here. Did you ever figure it out? |
👋 I'll close this since this doesn't appear to be a bug with Apollo Server, but rather a question about how to use it or one of its components. Rather than asking it here in GitHub Issues — where efforts are focused on fixing bugs and adding new features — I'd ask that you take this question to the Apollo Server channel within the Apollo community on Spectrum.chat where there are community members who might be able to relate to a similar problem, or might be able to help you out more interactively. Thanks for your understanding! |
@jbaxleyiii: while those support avenues may be more appropriate, they are also far harder to search. Almost two years later, a Google search for "get client IP apollo-server" produces this issue, and a StackOverflow question about getting the IP from a subscription (which doesn't answer this question). All in all, at least 3 people on this issue (though likely 300+ total) have been wasting their time reading this issue and trying to figure out something as basic as getting the IP of the client. Does this have to be that complicated and bureaucratic to not be simply answered in this issue, not even with the relevant link to StackOverflow? |
Anybody have any luck with this? |
@pbandjs: I posted a link to the correct solution in my comment above. |
As I walked through the code, it's impossible to get the client ip on plugin side. The only arguement passed to plugin side per request is @jbaxleyiii Please consider to add the raw http request as part of graphql context, so that plugins could obtain the original client ip from http. |
You have access to the raw request in your own |
I have a custom logging extension function:
Expected
To have access to either the node Request data or Koa
ctx
in relevant extension hooks.Actual
The
request
is missing all headers and it doesn't have the normal node Request object values rendering it of little to no value.Is there a way to access the actual Koa request
ctx
or otherwise get real request data?The text was updated successfully, but these errors were encountered: