mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:53:00 +03:00
🐛 Bug Report: Unable to see IP location #23
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @vilisseranen on GitHub.
Reproduction steps
When a user logs in, I see correct IP in the Audit log, but the location is always marked as unknown (except LAN IPs which are correctly flagged).
Expected behavior
Return the approximate location of the IP in the audit log
Actual Behavior
All non LAN IPs show as Unknown.
Pocket ID Version
1.10.0
Database
SQLite
OS and Environment
Docker on Ubuntu 24.04
Log Output
No log output related to IP location matching.
@vilisseranen commented on GitHub:
Please note that I tried with both
MAXMIND_LICENSE_KEYandMAXMIND_LICENSE_KEY_FILE(for the latter I pasted the file that you can download when you create an API key on the maxmind website.I also validated that the database is indeed present in the container.
Note that I also have the variable set
TRUST_PROXY=true.@warfair1337 commented on GitHub:
Having the exact same issue, Unknown for any location that is not LAN.
I tried setting this up for the first time today.
Using MAXMIND_LICENSE_KEY variable, it downloads the database GeoLite2-City.mmdb. Tried deleting and letting Pocket-ID re-download, but same result.
No errors in logs:
Sep 20 15:02:57 INF Updating GeoLite2 City database app=pocket-id version=1.11.1
Sep 20 15:02:58 INF GeoLite2 City database successfully updated. app=pocket-id version=1.11.1
@ItalyPaleAle commented on GitHub:
@vilisseranen if you type the IP in https://www.maxmind.com/en/geoip-demo do you see it geolocated?
@ItalyPaleAle commented on GitHub:
I am not really able to repro....
I wonder if the database is corrupted? Can you try deleting the
GeoLite2-City.mmdbfile and restart Pocket ID? It should re-fetch it.Also, can you take a look at the logs and share them? Especially if you see anything that could be relevant
@vilisseranen commented on GitHub:
Yes @ItalyPaleAle, it is properly located when I input the IP on the website.
@warfair1337 commented on GitHub:
Thanks. I noticed it started populating location after WAN-users began signing in after enabling Maxmind.
No issue here then, just my assumption getting the best of me ;-)
@ItalyPaleAle commented on GitHub:
Oh yeah that would make sense!
@ItalyPaleAle commented on GitHub:
Ok great, I'll close this issue then. Thanks for confirming
@vilisseranen commented on GitHub:
I think I found the issue. Some IPs are geolocated by Maxmind but do not provide a city name (and the accuracy is 200km instead of the 20km I see when the city is geolocated). This happens when I connect via mobile data.
I think the geolite_service always looks for City + Country and it's probably why I see the location as Unknown when I am on mobile data, but was able to see it properly located when I was using the wifi at my parents for example.
I'll try to create a PR for it.
@ItalyPaleAle commented on GitHub:
I cannot repro, this is working fine for me.
Just a note that the location is stored when the record is created, not when it's displayed. So after deleting the database and re-starting Pocket ID, you'd see it for new records only.
@vilisseranen commented on GitHub:
The IPs which don't have a city name in maxmind actually have an entry for the country in the audit_logs table. The issue was on the UI side which would show the location unknown unless both the city and country were present.