1
votes

I decided to play with lapis - https://github.com/leafo/lapis, but the application drops when I try to query the database (PostgreSQL) with the output:

2017/07/01 16:04:26 [error] 31284#0: *8 lua entry thread aborted: runtime error: attempt to yield across C-call boundary stack traceback: coroutine 0: [C]: in function 'require' /usr/local/share/lua/5.1/lapis/init.lua:15: in function 'serve' content_by_lua(nginx.conf.compiled:22):2: in function , client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"

The code that causes the error:

local db = require("lapis.db")
local res = db.query("SELECT * FROM users");

config.lua:

config({ "development", "production" }, {
    postgres = {
        host = "0.0.0.0",
        port = "5432",
        user = "wars_base",
        password = "12345",
        database = "wars_base"
    }
})

The database is running, the table is created, in table 1 there is a record.

What could be the problem?

Decision: https://github.com/leafo/lapis/issues/556

1

1 Answers

1
votes

You need to specify the right server IP in the host parameter.

The IP you have specified 0.0.0.0 is not a valid one, and normally it is used when you specify a listen address, with the meaning of "every address".

Usually you can use the '127.0.0.1' address during development.