Getting IP address from apollo server request

I’m trying to get the ip address of the client from the request object in the apollo context but everything I’ve tried so far has been futile. I can’t do req.ip since the request object from apollo server is of type IncomingMessage from the http module as opposed to the usual Request type. I’ve tried req.socket.remoteAddress but that just always returns ::1. I’d be glad if I can get any help on this.