Geolocation not working

We used to be on version 10 and we recently upgraded to version 21. Back then we didn’t have geolocation set up but after upgrading, I decided to enable geolocation on our instance of Sentry. I followed the steps in the documentation to enable geolocation and the database looks like it downloaded properly after I restarted all services:

Capture

However the heatmap was still showing no signs of geolocation data being captured:

Afterwards I modified our docker-compose.yml file:

x-sentry-defaults: &sentry_defaults
  environment:
    GEOIP_PATH_MMDB: "/geoip/GeoLite2-City.mmdb"
  volumes:
    - "./geoip:/geoip:ro"
services:
  geoipupdate:
    image: "maxmindinc/geoipupdate:latest"
    entrypoint:
      ["/usr/bin/geoipupdate", "-d", "/sentry", "-f", "/sentry/GeoIP.conf"]
    volumes:
      - "./geoip:/sentry"

I don’t know what else I’m missing. Is there a setting within the app that I have to do via the web browser? Can someone help me out?

Here’s my relay/config.yml:

relay:
  upstream: "http://web:9000/"
  host: 0.0.0.0
  port: 3000
logging:
  level: WARN
processing:
  enabled: true
  kafka_config:
    - {name: "bootstrap.servers", value: "kafka:9092"}
    - {name: "message.max.bytes", value: 50000000} #50MB or bust
  redis: redis://redis:6379
  geoip_path: "/geoip/GeoLite2-City.mmdb"
http:
  _client: "reqwest"

And here’s my sentry/sentry.conf.py:

#########
# GeoIP #
#########

GEOIP_PATH_MMDB = '/geoip/GeoLite2-City.mmdb'

Also, before I forget - after every change I made, I ran docker-compose restart to restart all services. I think based on the documentation, every time I do that, the database gets updated? I’m really confused as to what I’m doing wrong here.

Pinging our geoip mmdb expert @chadwhitacre here for help :smiley:

Thanks @BYK - it’s not a rush but I’d love it if we could get this to work. Most of our errors come from within the company’s network but we do have global users as well, just not as much.

@gregorip I’m able to reproduce your result. I have a valid GeoLite2-City.mmdb database, and both web and relay seem to be picking up what I’m putting down, yet I’m not seeing any evidence of IP address geolocation in the app. :thinking: Gonna have to dig deeper …

2 Likes

Thank you! I’ll be waiting for a solution. I appreciate the help!

2 Likes

False alarm. :frowning: I was hitting localhost with a private IP, which isn’t picked up. It still works for me with a public IP (via ngrok). Actually, though … could this be an issue for you, @gregorip? What IP addresses are you trying to geolocate? Are they public or private?

@chadwhitacre Majority of our traffic is on a private IP address, usually starts with 10.* - however we do have public-facing apps and some of our traffic comes from across the world, Europe, North and South America, China, etc.

I have the same issue.

Here is the traefik output to an example request:

traefik_1                                   | time="2021-03-15T15:48:24Z" level=debug msg="vulcand/oxy/roundrobin/rr: Forwarding this request to URL" ForwardURL="http://172.19.0.24:3000" Request="{\"Method\":\"POST\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/api/2/envelope/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\",\"RawFragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"application/json\"],\"Accept-Encoding\":[\"gzip, deflate, br\"],\"Content-Encoding\":[\"gzip\"],\"Content-Length\":[\"1174\"],\"X-Forwarded-For\":[\"87.xx.xx.134\"],\"X-Forwarded-Host\":[\"sentry.xxx.io\"],\"X-Forwarded-Port\":[\"443\"],\"X-Forwarded-Proto\":[\"https\"],\"X-Forwarded-Server\":[\"eb02169e087d\"],\"X-Real-Ip\":[\"87.xx.xx.134\"],\"X-Sentry-Auth\":[\"Sentry sentry_version=7,sentry_client=sentry.dotnet,sentry_key=xxx,sentry_timestamp=1615823303\"]},\"ContentLength\":1174,\"TransferEncoding\":null,\"Host\":\"sentry.xxx.io\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"87.xx.xx.134:64750\",\"RequestURI\":\"/api/2/envelope/\",\"TLS\":null}"`

I just found out that the geolocation works for a react project. :partying_face:
It doesn’t work for my c# project however.
I’m using those nugets:
Sentry.AspNetCore Version=3.1.0
Sentry.Serilog Version=3.1.0

Yeah, we were unable to replicate this issue. Could your C# project not sending a proper IP address to run geolocation on @klyse?

Not sure. Do I need to add something there?

using (SentrySdk.Init("https://xx@sentry.xx.io/2"))
{
	throw null;
}

It also looks good from the traefik logs (with IP), right?