Has anyone had any luck using standard LuaSocket with OpenResty? I am trying to get my reverse proxy to auto-register itself with our service discovery tool. when init_by_lua_file is called, the cosocket subsystem doesn't seem to have been created yet, so I wanted to revert to plain old blocking LuaSocket (since nginx hasn't started servicing requests yet).
I'm getting the following error:
nginx: the configuration file /opt/openresty/nginx/conf/nginx.conf syntax is ok
nginx: [error] init_by_lua_file error: /usr/local/share/lua/5.1/socket.lua:56: attempt to call field 'newtry' (a nil value)
stack traceback:
/usr/local/share/lua/5.1/socket.lua:56: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.1/socket/http.lua:10: in main chunk
[C]: in function 'require'
/opt/openresty/nginx/conf/lua/register_balancer.lua:5: in main chunk
nginx: configuration file /opt/openresty/nginx/conf/nginx.conf test failed
socket.newtry() is contained in /usr/local/lib/lua/5.1/core.so
My cpath variables seem to be correct:
lua_package_cpath ";;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/socket/?.so;/usr/local/lib/lua/5.1/socket/core.so";
Has anyone done this before, or have any ideas why it's not correctly loading core.so?