N
Neon2y ago
fascinating-indigo

password authentication failed

Hi while trying to create tables through drizzle, we face password authentication failed for user 'xxxxx'> where can I get the user ? I just see the role in the connection string
6 Replies
quickest-silver
quickest-silver2y ago
You can find you connection string, including the username and password in the neon Console: https://neon.tech/docs/connect/connect-from-any-app
Neon
Connect from any application - Neon Docs
When connecting to Neon from an application or client, you connect to a database in your Neon project. In Neon, a database belongs to a branch, which may be the primary branch of your project (main) o...
fascinating-indigo
fascinating-indigoOP2y ago
Thank @ShinyPokemon I have followed the steps, Drizzle is able to create the tables, but each time I try to insert data, I face the following error: error: the role xxx does not exist Any idea?
quickest-silver
quickest-silver2y ago
This suggests you're trying to login as a user that does not exist. Double check that the role/user exists and check your connection string.
fascinating-indigo
fascinating-indigoOP2y ago
Strange, I am using the same information as for the table creation.
deep-jade
deep-jade13mo ago
Hi, I am working on a Nodejs/Express application, and I am trying to connect to a newly created Neon postgres database with knex ORM. My knexfile.js file is below. I have taken the values of all the env variables (PGHOST, PGDATABASE, PGUSER, PGPASSWORD) from the Neon database credentials. However, while running the migration command npx knex migrate:latest --knexfile db/knexfile, I am getting the error error: password authentication failed for user "darkk" Here, darkk is my Windows laptop username through which I login to my laptop. I don't know why this username is being used to log into the Neon database, when I have already provided the correct credentials to connect to the Neon db. Also, I am able to successfully connect to the Neon db using my locally installed pgAdmin 4 application, so I am clueless as to why through my Nodejs application I am unable to connect. Can anyone suggest how to get rid of this error?
import dotenv from 'dotenv';
dotenv.config();

const knexConfig = {
development: {
client: 'pg',
connection: {
host: process.env.PGHOST,
port: process.env.PGPORT || 5432,
database: process.env.PGDATABASE,
user: process.env.PGUSER,
password: String(process.env.PGPASSWORD),
},
pool: {
min: 2,
max: 10,
},
migrations: {
tableName: 'knex_migrations',
},
},
};

export default knexConfig;
import dotenv from 'dotenv';
dotenv.config();

const knexConfig = {
development: {
client: 'pg',
connection: {
host: process.env.PGHOST,
port: process.env.PGPORT || 5432,
database: process.env.PGDATABASE,
user: process.env.PGUSER,
password: String(process.env.PGPASSWORD),
},
pool: {
min: 2,
max: 10,
},
migrations: {
tableName: 'knex_migrations',
},
},
};

export default knexConfig;
ambitious-aqua
ambitious-aqua12mo ago
@SleepyOwl007 Can you share a minimal reproducible?

Did you find this page helpful?