[PostgreSQL error] failed to bootstrap database: ERROR: must be owner of relation locks

#1

I’m trying to bootstrap a new DB for kong 1.0.3

AWS RDS Postgres 9.5.15
docker kong:1.0.3

Create user and DB

CREATE USER kong_proxy WITH ENCRYPTED PASSWORD ‘xxxxx’;
GRANT kong_proxy TO postgres;
CREATE DATABASE kong_proxy OWNER kong_proxy;
GRANT ALL PRIVILEGES ON DATABASE kong_proxy TO kong_proxy;

Relevant log

2019/03/28 14:25:41 [verbose] retrieving database schema state…
2019/03/28 14:25:41 [verbose] schema state retrieved
2019/03/28 14:25:41 [info] bootstrapping database…
2019/03/28 14:25:41 [verbose] creating ‘schema_meta’ table if not existing…
2019/03/28 14:25:41 [verbose] successfully created ‘schema_meta’ table
2019/03/28 14:25:41 [verbose] creating ‘locks’ table if not existing…
Error:
/usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:55: [PostgreSQL error] failed to bootstrap database: ERROR: must be owner of relation locks
stack traceback:
[C]: in function ‘assert’
/usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:55: in function ‘bootstrap’
/usr/local/share/lua/5.1/kong/cmd/migrations.lua:118: in function ‘cmd_exec’
/usr/local/share/lua/5.1/kong/cmd/init.lua:87: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:87>
[C]: in function ‘xpcall’
/usr/local/share/lua/5.1/kong/cmd/init.lua:87: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:44>
/usr/local/bin/kong:7: in function ‘file_gen’
init_worker_by_lua:48: in function <init_worker_by_lua:46>
[C]: in function ‘xpcall’
init_worker_by_lua:55: in function <init_worker_by_lua:53>

Create table with user kong_proxy using psql cmd

Password for user kong_proxy:
psql (9.5.12, server 9.5.15)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type “help” for help.

kong_proxy=> CREATE TABLE test_table(
kong_proxy(> user_id serial PRIMARY KEY,
kong_proxy(> username VARCHAR (50) UNIQUE NOT NULL,
kong_proxy(> password VARCHAR (50) NOT NULL,
kong_proxy(> email VARCHAR (355) UNIQUE NOT NULL,
kong_proxy(> created_on TIMESTAMP NOT NULL,
kong_proxy(> last_login TIMESTAMP
kong_proxy(> );
CREATE TABLE

Any Ideas to what might be wrong?

0 Likes

#2

I misspelled the name of KONG_PG_DATABASE env variable so the name of the database did not take effect and migrations were trying to be run against database named kong which in my case is in use by another kong instance

0 Likes