Hello!
On Fri, Oct 11, 2013 at 12:08 PM, Veniamin Gvozdikov wrote:
> nginx: [error] failed to run init_by_lua*: /Users/me/Devel/lib/foo.lua:6: no
> request object found
> stack traceback:
> [C]: in function 'say'
> /Users/me/Deve/llib/foo.lua:6: in function 'go'
> /Users/me/Devel/init.lua:6: in main chunk
No, you're not trying my example. You're trying your example with
obvious programming mistakes.
You call foo.go() directly in the context of init_by_lua, which does
not make sense at all. Because foo.go() is generating a response via
ngx.say(). The error message above clearly indicates that there is no
request object associated with the current (init_by_lua) context
(init_by_lua runs in the nginx master process during nginx startup or
reload).
Note that I call foo.go() in the context of content_by_lua in my example.
Regards,
-agentzh