-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Hello
I have been working through the graphql.js tutorial, particularly the section on "Authentication and Express Middleware". I encountered an issue when trying to execute the API designed to return the caller's IP address. Unfortunately, instead of receiving the expected IP address, the API response was data: { ip: null }
.
Here are the steps I followed:
- I set up the environment and dependencies as outlined in the tutorial.
- Followed the instructions in the "Authentication and Express Middleware" section to implement the API for returning the caller's IP address.
- Executed a query expecting to receive the caller's IP address in the response.
Expected Result:
I expected to receive a response containing the caller's IP address, similar to data: { ip: "caller's IP address" }
.
Actual Result:
The response was data: { ip: null }
, indicating that the IP address could not be retrieved or was not properly passed through the middleware.
var root = {
ip: function (args, request) {
return request.ip // request is undefined
},
}
Dependencies:
"dependencies": {
"express": "^4.18.3",
"graphql": "^16.8.1",
"graphql-http": "^1.22.0",
"ruru": "^2.0.0-beta.11"
}
I double-checked the code and setup to ensure compliance with the tutorial instructions but could not identify any deviations or mistakes on my part that could cause this issue.
I would greatly appreciate any guidance or suggestions you could offer to resolve this issue. If there are any additional details or information you need, please let me know, and I'll be happy to provide them.
Thank you for your time and support.