8000 bad request on repeated requests · Issue #128 · leafo/pgmoon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
bad request on repeated requests #128
Open
@r614

Description

@r614

hi! i am running into the following error when my openresty/nginx server gets repeated requests to an endpoint.
after a certain point, all requests start failing with:

2022/07/05 22:32:21 [error] 7#7: *24332 lua entry thread aborted: runtime error: /usr/local/openresty/luajit/share/lua/5.1/pgmoon/init.lua:251: bad request
stack traceback:
coroutine 0:
	[C]: in function 'connect'
	/usr/local/openresty/luajit/share/lua/5.1/pgmoon/init.lua:251: in function 'connect'
	/usr/local/openresty/nginx//rewrite.lua:66: in function 'connect'
	/usr/local/openresty/nginx//rewrite.lua:92: in function 'pod_data_by_id'
	/usr/local/openresty/nginx//rewrite.lua:132: in function 'go'
	rewrite_by_lua(nginx.conf:45):2: in main chunk, client: <ip>, server: , request: "GET /?auth-token=<some_token>HTTP/1.1", host: <some host>

it's failing when calling the connect function on a request:

local _pg_cfg = pgmoon.new({
  host = os.getenv("pg_host"),
  port = os.getenv("pg_port"),
  user = os.getenv("pg_user"),
  database = os.getenv("pg_db"),
  password = os.getenv("pg_pw")
})


local connect = function()
  local success, err = _pg_cfg:connect()
  if err ~= nil then
    ngx.log(ngx.ERR, err)
    ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
  end
  if not success then
    ngx.log(ngx.ERR, "Could not acquire a Postgres connection")
    ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
  end
  return _pg_cfg
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0