auth0 / nginx-jwt

Lua script for Nginx that performs reverse proxy auth using JWT's
MIT License
535 stars 119 forks source link

*1 lua entry thread aborted: runtime error: access_by_lua(nginx.conf:23):2: attempt to perform arithmetic on global 'nginx' (a nil value) #52

Closed BrianAdams closed 8 years ago

BrianAdams commented 8 years ago

Anyone have any ideas on where to look for the issue? I am using the configuration from the tests/default.

I get this error regardless of the presence of the nginx-jwt.

        location /secure {
            access_by_lua '
                local jwt = require("nginx-jwt")
                jwt.auth()
            ';

            proxy_pass http://5.5.5.5:5555/secure;
        }

If I change the name in the require I get the same message but with the updated name... so:

                local jwt = require("xnginx-jwt")

gives me an error: attempt to perform arithmetic on global 'xnginx' (a nil value)

I have the lua_pacakge_path

    lua_package_path '/opt/openresty/nginx/lua/?.lua;;';

And my folder structure:

/opt/openresty/nginx # tree
.
├── conf
│   └── nginx.conf
├── html
├── lua
│   ├── basexx.lua
│   ├── nginx-jwt.lua
│   ├── resty
│   │   ├── evp.lua
│   │   ├── hmac.lua
│   │   └── jwt.lua
│   └── version.txt
└── sbin
    └── nginx
BrianAdams commented 8 years ago

Looks like I had an escaping issue in my template that was removing the quotes around nginx-jwt.