0x-api
0x-api copied to clipboard
Role 'api' does not exist.
Hi,
I cloned repo and followed all steps, but when I run yarn start
command, I get this error,
{"level":"error","time":1585508440972,"pid":44459,"hostname":"Rahuls-MacBook-Pro.local","name":"error","length":95,"severity":"FATAL","code":"28000","file":"miscinit.c","line":"607","routine":"InitializeSessionUserId","msg":"role "api" does not exist","stack":"error: role "api" does not exist\n
my .env
file is,
CHAIN_ID=1337
ETHEREUM_RPC_URL=http://ganache:8545
MESH_WEBSOCKET_URI=
MESH_HTTP_URI=
FEE_RECIPIENT_ADDRESS=
MAKER_FEE_ASSET_DATA=
MAKER_FEE_UNIT_AMOUNT=
MAKER_FEE_ASSET_DATA=
TAKER_FEE_UNIT_AMOUNT=
POSTGRES_URI=
WHITELIST_ALL_TOKENS=
Please guide me on what I am missing here. Thanks
I also ran into this issue. It sounds like my situation may have been a little bit different than yours in that I had previously been able to run the 0x-API, but this emerged when I pulled the current master
branch.
I was able to fix the issue locally by removing the postgres
directory, which was created in the 0x-api root directory. Let me know if this fixes the issue for you as well.
Hey @jalextowle , I tried as you said, but it doesn't seems to be working for me.
@rhrahul , the current config in docker-compose.yml
expects an existing postgres role api
, however this doesn't come in the default postgres:9.6
image.
We'll look into fixing this by updating the docker-compose.yml
file.
In the meantime, you can get around this by manually creating a role and database.
Start up docker services:
$ docker-compose up
Obtain container ID for the postgres container and start a shell into it:
$ docker ps
$ docker exec -it <CONTAINER_ID> /bin/bash
Start the psql
utility:
psql
The rest of these commands should be run from within psql:
CREATE ROLE api WITH LOGIN ENCRYPTED PASSWORD 'api';
\du // verify that the new role is created
CREATE DATABASE api WITH OWNER = api;
After this try running yarn start
again.
Hey @xianny, I tried as you said but now I am getting following error,
column cnst.consrc does not exist QueryFailedError: column cnst.consrc does not exist
FWIW my local version of postgres was conflicting with 0x API's exposed docker version of postgres.
A quick hackaround for me was:
- Changing the
docker-compose.yml
to exposepostgres
on a different port:
volumes:
- ./postgres:/var/lib/postgresql/data
ports:
- - "5432:5432"
+ - '3333:5432'
- Running my desired 0x API command (
yarn test
) with a customPOSTGRES_URI
ENV var:
POSTGRES_URI=postgresql://api:api@localhost:3333/api yarn test