-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error at lookup IP #5
Comments
double #4. |
@anjia0532 thanks! but not Im getting: |
try again plz. lua-resty-maxminddb/lib/resty/maxminddb.lua Line 324 in a77675b
can u install libmaxminddb lib? |
@anjia0532 It's already installed..now it's working but I'm getting empty table. |
this lab is work for me , can u paste your test ip?or u can add some code to debug. e.g. print lua-resty-maxminddb/lib/resty/maxminddb.lua Line 181 in a77675b I think the problem should be in lua-resty-maxminddb/lib/resty/maxminddb.lua Lines 243 to 288 in a77675b
good luck |
This is my code |
is this db file ( |
I can't get this module to work either with openresty v1.13.6.2. Installed v0.03 of lua-resty-maxminddb via OPM. I've got all the prerequisites installed but Code:
Here's what
|
@jloh It's my fault. lua-resty-maxminddb/lib/resty/maxminddb.lua Line 324 in 7a367a4
at v0.03 the var |
@anjia0532 I could never get any exceptions to fire, I just can't get the module to return any geo data at this stage, it always just returns blank/an empty JSON array. Tried the change you've suggested but got the same thing:
Config:
Tested it against 8.8.8.8 as well:
|
your local
{"country":{"geoname_id":6252001,"names":{"en":"United States","ru":"США","fr":"États-Unis","pt-BR":"Estados Unidos","zh-CN":"美国","es":"Estados Unidos","de":"USA","ja":"アメリカ合衆国"},"iso_code":"US"},"registered_country":{"geoname_id":6252001,"names":{"en":"United States","ru":"США","fr":"États-Unis","pt-BR":"Estados Unidos","zh-CN":"美国","es":"Estados Unidos","de":"USA","ja":"アメリカ合衆国"},"iso_code":"US"},"continent":{"geoname_id":6255149,"names":{"en":"North America","ru":"Северная Америка","fr":"Amérique du Nord","pt-BR":"América do Norte","zh-CN":"北美洲","es":"Norteamérica","de":"Nordamerika","ja":"北アメリカ"},"code":"NA"},"location":{"longitude":-97.822,"accuracy_radius":1000,"latitude":37.751}} |
Sorry @anjia0532! I didn't see your update. I can confirm that updating to |
@jloh Cheers |
local cjson=require 'cjson' local arg_ip=ngx.var.arg_ip ngx.say("IP:",arg_ip,", Node:",arg_node," if not geo.initted() then local res,err=geo.lookup(arg_ip or ngx.var.remote_addr) if not res then ",arg_ip," ")ngx.log(ngx.ERR,' failed to lookup by ip , reason :',err) else ngx.say("Result:",cjson.encode(res))
-- ngx.say(cjson.encode(res['country'])) end 上面这段代码在 curl -k -L "http://192.168.137.70/lua?ip=111.47.224.182&node=subdivisions" 出现异常了 2018/12/07 15:51:23 [alert] 6466#0: worker process 13218 exited on signal 11 |
172.17.0.1 - - [21/May/2018:11:55:04 +0000] "GET / HTTP/1.1" 200 0 "-" "curl/7.54.0"
2018/05/21 11:55:04 [error] 6#6: *5 lua entry thread aborted: runtime error: /usr/local/openresty/site/lualib/resty/maxminddb.lua:323: bad argument #1 to 'concat' (table expected, got nil)
stack traceback:
coroutine 0:
[C]: in function 'concat'
/usr/local/openresty/site/lualib/resty/maxminddb.lua:323: in function 'lookup'
/src/geo.lua:6: in function </src/geo.lua:1>, client: 172.17.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8081"
The text was updated successfully, but these errors were encountered: