leafo / lapis

A web framework for Lua and OpenResty written in MoonScript
http://leafo.net/lapis/
MIT License
3.12k stars 247 forks source link

macos openssl run time error #688

Closed byoungdale closed 4 years ago

byoungdale commented 4 years ago

I am getting the following run time error when I try to connect to my running lapis server on macos:

content_by_lua(nginx.conf.compiled:22):2: in main chunk, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "127.0.0.1:8080"
2020/04/06 08:20:07 [error] 35986#256305: *1 lua entry thread aborted: runtime error: error loading module '_openssl.hmac' from file '/usr/local/lib/lua/5.1/_openssl.so':
    dlopen(/usr/local/lib/lua/5.1/_openssl.so, 6): Symbol not found: _EVP_PKEY_get_raw_private_key
  Referenced from: /usr/local/lib/lua/5.1/_openssl.so
  Expected in: flat namespace
 in /usr/local/lib/lua/5.1/_openssl.so
stack traceback:
coroutine 0:
    [C]: in function 'require'
    content_by_lua(nginx.conf.compiled:22):2: in main chunk, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "127.0.0.1:8080"

I have looked at issue 686 and the building openssl guide. But, I think those are my problem because the error is different and I don't have any problems connecting when I run only openresty.

Here is how I installed everything:

brew install openresty/brew/openresty

sudo luarocks install luaossl CRYPTO_DIR=/usr/local/opt/openresty-openssl/ OPENSSL_INCDIR=/usr/local/opt/openresty-openssl/include

sudo luarocks install lapis

ln -s /usr/local/opt/openresty/bin/openresty /usr/local/opt/openresty/bin/nginx

lapis server

Then open 127.0.0.1:8080 in a browser or run curl http://localhost:8080/, and I get the error above.

Seems like something between my Lua installation, openresty, and Lapis went funky, but I'm not sure what.

byoungdale commented 4 years ago

Fixed this issue. The _openssl.so object file it was looking at was old. I deleted it and everything is working.