When saving data to Firebase database with a Firebase cloud function, I'd like to also write the IP address where the request comes from.
However, req.connection.remoteAddress
always returns ::ffff:0.0.0.0
. Is there a way to get the actual IP address of the client that makes the request?
The clients IP is in request.ip
.
Example:
export const pay = functions.https.onRequest((request, response) => { console.log(`My IP is ${request.ip}`); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With