bungle / lua-resty-session

Session library for OpenResty – flexible and secure
BSD 2-Clause "Simplified" License
318 stars 111 forks source link

module 'lua_pack' not found #158

Closed chaserb closed 1 year ago

chaserb commented 1 year ago

Discovered the following in /usr/loca/openresty/nginx/logs/error.log after newly launched servers started throwing 500 errors in their health checks:

2023/02/02 20:47:28 [error] 14907#14907: *1 lua entry thread aborted: runtime error: /usr/local/openresty/site/lualib/resty/session/utils.lua:95: module 'lua_pack' not found:
    no field package.preload['lua_pack']
    no file '/usr/local/openresty/site/lualib/lua_pack.ljbc'
    no file '/usr/local/openresty/site/lualib/lua_pack/init.ljbc'
    no file '/usr/local/openresty/lualib/lua_pack.ljbc'
    no file '/usr/local/openresty/lualib/lua_pack/init.ljbc'
    no file '/usr/local/openresty/site/lualib/lua_pack.lua'
    no file '/usr/local/openresty/site/lualib/lua_pack/init.lua'
    no file '/usr/local/openresty/lualib/lua_pack.lua'
    no file '/usr/local/openresty/lualib/lua_pack/init.lua'
    no file './lua_pack.lua'
    no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/lua_pack.lua'
    no file '/usr/local/share/lua/5.1/lua_pack.lua'
    no file '/usr/local/share/lua/5.1/lua_pack/init.lua'
    no file '/usr/local/openresty/luajit/share/lua/5.1/lua_pack.lua'
    no file '/usr/local/openresty/luajit/share/lua/5.1/lua_pack/init.lua'
    no file '/usr/local/openresty/site/lualib/lua_pack.so'
    no file '/usr/local/openresty/lualib/lua_pack.so'
    no file './lua_pack.so'
    no file '/usr/local/lib/lua/5.1/lua_pack.so'
    no file '/usr/local/openresty/luajit/lib/lua/5.1/lua_pack.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
coroutine 0:
    [C]: in function 'require'
    access_by_lua(nginx.conf:119):41: in main chunk, client: 127.0.0.1, server: myhost.com, request: "GET / HTTP/1.1", host: "localhost"

These are the packages I've installed on the servers (Debian 11):

./opm install ledgetech/lua-resty-http
./opm install bungle/lua-resty-session
./opm install zmartzone/lua-resty-openidc

...producing:

admin@myhost:~$ opm list
bungle/lua-resty-session                                     4.0.0
jkeys089/lua-resty-hmac                                      0.06
zmartzone/lua-resty-openidc                                  1.7.5
cdbattags/lua-resty-jwt                                      0.2.0
ledgetech/lua-resty-http                                     0.16.1
openresty/lua-resty-string                                   0.11

Any suggestions on how I should provide the lua_pack dependency?

bungle commented 1 year ago
luarocks install lua_pack

See also: https://github.com/Kong/lua-pack

manual install is possible too.

GordonMcKinney commented 1 year ago

Same issue. OpenResty explicitly rejects the use of luarocks for adding packages. I don't seen an opm for lua-pack.

GordonMcKinney commented 1 year ago

I have to apply the following workaround to solve my production issue:

opm install bungle/lua-resty-session=3.10
bungle commented 1 year ago

openresty does not explicitly reject packages installed with luarocks. I may look in a future of doing binary packing without lua_pack, but for now it is a dependency.