ledgetech / lua-resty-redis-connector

Connection utilities for lua-resty-redis
234 stars 71 forks source link

no request object found #8

Closed jney closed 7 years ago

jney commented 8 years ago

at code

local redis, err = rc:connect{ url = 'redis://h:xxxx@ec2-11-11-11-11.eu-west-1.compute.amazonaws.com:999' }

i've got following error

2016-06-24T17:02:33.635965+00:00 app[web.1]: 2016/06/24 17:02:32 [error] 62#0: [lua] kong.lua:168: init(): Startup error: /app/.heroku/share/lua/5.1/kong/tools/utils.lua:211: /app/.heroku/share/lua/5.1/resty/redis/connector.lua:70: no request object found

i don't get it. is the url string malformed ?

pintsized commented 7 years ago

Sorry for the very slow reply. The URL string looks ok (although note, there is no USERNAME:PASSWORD@HOST in redis auth, just PASSWORD@HOST.

I'm guessing you're trying to use this during init_by_lua? If so, you need to start a light thread using the ngx.timer for that to work, see the docs here: https://github.com/openresty/lua-nginx-module#cosockets-not-available-everywhere