nokia / kong-oidc

OIDC plugin for Kong
Apache License 2.0
454 stars 320 forks source link

hmac.lua:81: size of C type is unknown or too large at line 44 stack traceback #157

Closed NilsTellow closed 4 years ago

NilsTellow commented 4 years ago

Hi all,

Installed the plugin on my test environment. I've set everything up with as requested in the getting started having Auth0 as Identification service but I'm getting the following error.

2020/04/08 08:21:54 [error] 22#0: *22341 lua coroutine: 
runtime error: /usr/local/share/lua/5.1/resty/hmac.lua:81: size of C type is unknown or too large at line 44
stack traceback:
coroutine 0:
    [C]: in function 'require'
    /usr/local/share/lua/5.1/resty/openidc.lua:763: in function 'openidc_load_jwt_and_verify_crypto'
    /usr/local/share/lua/5.1/resty/openidc.lua:844: in function 'openidc_load_and_validate_jwt_id_token'
    /usr/local/share/lua/5.1/resty/openidc.lua:928: in function 'authenticate'
    /usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:47: in function 'make_oidc'
    /usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:38: in function 'handle'
    /usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:20: in function </usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:14>
coroutine 1:
    [C]: in function 'resume'
    coroutine.wrap:21: in function <coroutine.wrap:21>
    /usr/local/share/lua/5.1/kong/init.lua:683: in function 'access'
    access_by_lua(nginx-kong.conf:104):2: in main chunk, client: [Removed for privacy]
2020/04/08 08:21:54 [error] 22#0: *22341 [kong] init.lua:690 /usr/local/share/lua/5.1/resty/hmac.lua:81: size of C type is unknown or too large at line 44, client: [Removed for privacy] 

It is probably related to the following issue: https://github.com/Kong/kong/issues/5549

fffonion commented 4 years ago

@NilsTellow Hi, please try update the lua-resty-jwt library, the above issue has been fixed in 0.2.2

NilsTellow commented 4 years ago

Truly thankful for the quick reply @fffonion. Is it correct to assume that, installing lua-resty-jwt before installing lua-resty-openidc will resolve the issue?

FROM kong:2.0.3

USER root

RUN luarocks install lua-resty-jwt
RUN luarocks install lua-resty-openidc
RUN luarocks install kong-oidc

USER kong
fffonion commented 4 years ago

In fact you don't need to explictly install lua-resty-jwt, you will only need to upgrade it if you previously installed the old version, which is not the case for docker. ~luarocks install lua-resty-openidc will be sufficient:~ Well actually the version pinned in kong-oidc is sufficient to pull the latest lua-resty-jwt, so i'd just try

luarocks install kong-oidc

directly.

NilsTellow commented 4 years ago

Fixed. Thank you @fffonion! Last image I built was two days ago. Maybe a cached version?