haproxytech / haproxy-lua-http

Simple Lua HTTP helper && client for use with HAProxy.
Apache License 2.0
56 stars 23 forks source link

too many C levels #15

Closed schklom closed 2 years ago

schklom commented 2 years ago

Hi,

I have manually imported your lua script into /usr/local/share/lua/5.3/haproxy-lua-http.lua along with https://github.com/TimWolla/haproxy-auth-request/blob/main/auth-request.lua and https://github.com/rxi/json.lua (I want to use Authelia).

After this, I tried adding the required loading lines in the global section

lua-prepend-path /usr/local/share/lua/5.3/haproxy-lua-http.lua
lua-load /usr/local/share/lua/5.3/auth-request.lua

When adding the second line, then HAProxy starts to complain about your file and I have no idea why:

Errors found while starting haproxy
[NOTICE] 013/044744 (18131) : haproxy version is 2.2.14-a07ac36
[ALERT] 013/044744 (18131) : parsing [/var/etc/haproxy_test/haproxy.cfg:25] : Lua runtime error: error loading module 'json' from file '/usr/local/share/lua/5.3/haproxy-lua-http.lua':
/usr/local/share/lua/5.3/haproxy-lua-http.lua:673: too many C levels (limit is 200) in function at line 619 near 'v' 

Can you help me figure this out?

Many thanks :)

hjone72 commented 2 years ago

You need to provide a lua json library.

https://github.com/haproxytech/haproxy-lua-http/blob/master/http.lua#L33

schklom commented 2 years ago

Thank you so much!