When I use the Postgres database on Supabase I run the following command, npx prisma migrate dev --name init, but I get the following error (first command in screenshot):
Error: db error: FATAL: bouncer config error
0: migration_core::state::DevDiagnostic
at migration-engine/core/src/state.rs:251
When I use railway.app, with a Postgres database it migrates successfully (second command in screenshot).
I fixed this error on my end by replacing the port number of my connection string from 6543 to 5432.
Reason: 6543 is the pooled port number which should not be used when migrating, instead the non-pooled connection string using 5432 should be used
Hope this helps!
Source:
Second paragraph of the section "Connection pooling with Supabase" https://supabase.com/docs/guides/integrations/prisma#connection-pooling-with-supabase
Related
While creating migration via the CLI command npx mikro-orm migration:create, it throws the error:
MikroORM failed to connect to database test on postgresql://postgres#127.0.0.1:5432
As you can see it tries to connect to port number 5432 which is the default port number given while setting up PostgreSQL but I had changed that port number to 5000 while setting up PSQL on my system.
How do I make MikroORM connect to port 5000?
Refer to the docs. You are looking for the port option.
setting up a default chainlink node with docker containers. I decided to spin up my postgresql on another docker container and I am trying to use it as my default db for the node, currently I'm trying to figure out why my postgresql db seems to be refusing my connections I'm getting this error below, I've confirmed that my postgresql container is running correctly on localhost 5432 but the error seems to want me to edit some config file somewhere to allow access to make the connection but I'm not sure where that is or if that's the case? sorry I'm new to docker at the moment
[ERROR] failed to initialize database, got error failed to
connect to `host=192.168.1.198 user=postgres database=postgres`:
server error (FATAL: no pg_hba.conf entry for host "192.168.1.198",
user "postgres", database "postgres", SSL off (SQLSTATE 28000))
here is my docker run command which I'm following per -> https://docs.chain.link/docs/running-a-chainlink-node/
docker run -p 6688:6688 -v -it --env-file=.env smartcontract/chainlink:0.10.11 local n
here is my actual .env file being accessed when the nodes container is being created by the above command, for reference I am running the command from the same directory as the .env file
ROOT=/chainlink
LOG_LEVEL=debug
MIN_OUTGOING_CONFIRMATIONS=2
ETH_CHAIN_ID=4
LINK_CONTRACT_ADDRESS=xxxxxxxxxxxxxxxxxxxxxxx
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
GAS_UPDATER_ENABLED=true
FEATURE_FLUX_MONITOR=true
ALLOW_ORIGINS=*
DATABASE_URL=postgresql://postgres:somePassword#192.168.1.198:5432/postgres?sslmode=disable
ETH_URL=wss://ropsten.infura.io/ws/v3/xxxxxxxxxxxxxxxxxxxxxxx
DATABASE_TIMEOUT=0
the error seems to want me to edit some config file somewhere to allow access to make the connection but I'm not sure where that is or if that's the case
Yes pg_hba.conf is a file that postgres use for controlling client authentication. You must edit it for allowing remote clients to talk to it.
For a dev environment you must be good allowing all.
Although, I will try first to run both containers in the same docker network keeping pg_hba.conf as is. My guess is that the official postgres image allow traffic originating from the same network.
More resources here and here (see POSTGRES_HOST_AUTH_METHOD)
To summarize, I am trying to run a Chainlink node via Docker on an Azure VM. I also created an Azure Postgresql DB and verified the VM is able to connect via psql cli.
Steps I took to get the node running (following this link):
Create Azure VM
Install docker
mkdir ~/.chainlink-rinkeby
Created .env file
Set ETH_URL via an External Provider
Create Postgres SQL Database following this link
Set Remote Database_Url config using sslmode=disable
Start the node with:
cd ~/.chainlink-rinkeby && docker run -p 6688:6688 -v ~/.chainlink-rinkeby:/chainlink -it --env-file=.env smartcontract/chainlink local n
My .env file:
"ROOT=/chainlink LOG_LEVEL=debug ETH_CHAIN_ID=4 MIN_OUTGOING_CONFIRMATIONS=2 LINK_CONTRACT_ADDRESS=0x01BE23585060835E02B77ef475b0Cc51aA1e0709 CHAINLINK_TLS_PORT=0 SECURE_COOKIES=false GAS_UPDATER_ENABLED=true ALLOW_ORIGINS=*"
"ETH_URL=wss://cl-rinkeby.fiews.io/v1/MY_API_KEY"
"DATABASE_URL=postgresql://MY_USER_NAME:MY_PASSWORD#MY_DATABASE_nAME.postgres.database.azure.com:5432/postgres?sslmode=disable"
Error:
[ERROR] unable to lock ORM: dial tcp 127.0.0.1:5432: connect: connection refused logger/default.go:139 stacktrace=github.com/smartcontractkit/chainlink/core/logger.Error
I've also tried giving a version of 0.10.8 in the chainlink startup command but the error I get for that is:
[ERROR] failed to initialize database, got error failed to connect to `host=/tmp user=root database=`: dial error
You are trying to connect your Chainlink node to a remote PostgreSQL database. This database is managed by AZUR's cloud service and hosted and administered there internally. The issue with the connection is that the Chainlink node wants to establish a connection to 127.0.0.1 and is therefore convinced that the Postgres is located locally in your Chainlink docker container.
A docker container is an own environment and represent an own host, so 127.0.0.1 will loopback into the container itself. I recommend you to have a look here on the official network documentation of docker: https://docs.docker.com/config/containers/container-networking/
With the version 0.10.8 you established a connection. The issue here is now related to the USER and the DATABASE. Please ensure that you create a database and an own USER for it and not use the admin credentials (root) like the superuser.
You can enter the postgres via the azur cli and type in the following lines:
CREATE DATABASE <yourdbname>;
CREATE USER <youruser> WITH ENCRYPTED PASSWORD '<yourpass>';
In addition you can have a look at this post related to the connection to your postgres database:
https://stackoverflow.com/a/67992586/15859805
I am very new to postgreSQL and struggling to create a connection in my Eclipese.
Here is what I have done till now:
Installed DBeaver plugin for eclipse from marketplace.
Installed PostgreSQL version 10 from https://www.postgresql.org/download/windows/
Now I attempt to create a connection in Eclipse but I get an error "FATAL: password authentication failed for user "testuser"
I checked through a similar thread (
Getting authentication failed error with postgresql from command line
) but could not resolve the issue.
Could you please help.
To connect the PostgreSQL via Command line you have to install a PostgreSQL provided tool called "psql" if not installed already.
Then use the below command to connect to PostgreSQL database.
psql -h localhost -p 5432 -U postgres
Explanation:
localhost: is the hostname of machine where PostgreSQL is installed.
5432 : is the default PostgreSQL port
postgres : is the username of to connect to DB
Solution for your issue:
FATAL: password authentication failed for user "testuser"
As error message specified, either user not exists on database or the password that you supplied to connect is incorrect. Re-verify your user and password, and try again.
All the best.
I have added a configured postgres database add-on to a heroku app.
When I try to connect to the database outside the heroku (from my local machine) it always gives an error
SSL SYSCALL error: Connection reset by peer (0x00002746/10054)
I have tried connection from Heroku CLI as well as PGAdmin. I have tried configuring SSL mode to Require.
psql -h ec2-79-125-6-82.eu-west-1.compute.amazonaws.com -U d168639egmjee csjpgbglovnmah
Any idea how can I connect to the postgres DB added in heroku app?
Any help will be appreciated.