Trying to Set Up Postgres for Ror App, Getting Error - Fe_Sendauth: No Password Supplied

Trying to set up postgres for ror app, getting error - fe_sendauth: no password supplied

You need to change your change your pg_hba.conf. Here's an example of mine:

pg_hba.conf:

TYPE  DATABASE        USER            ADDRESS                 METHOD

host all all 127.0.0.1/32 trust

host all PC 127.0.0.1/32 trust

host all all ::1/128 trust

Note that trust means that anyone on address (in this case localhost) can connect as the listed user (or in this case any user of their choice). This is really only suitable for development configurations with unimportant data. Do not use this in production.

Rails + Postgres fe_sendauth: no password supplied

First you should change:

local   all             all                                     trust

to:

local   all             all                                     md5

Then, You should create a super_user in PostgreSQL with username and password,after that adding username and password of new user to your database.yml file.

To create new super_user, open Pg Admin III and right click at the bottom Login Roles to create new super user.

Rails: fe_sendauth: no password supplied (PG::ConnectionBad) from Ruby, but ok in Rails

You don't specify neither username, no password in your ActiveRecord::Base.establish_connection(. I assume you want to use some SUPERUSER without password for www_development database - right?

as per documentation peer auth does

Obtain the client's operating system user name from the operating
system and check if it matches the requested database user name.

That is why if you can psql without password, you should be able run app.rb with same OS user and environment without password. If you can't, then app.rb tries to connect with different username or so...

Options:

  1. put username: postgres to ActiveRecord::Base.establish_connection(

  2. change local all all peer to local all all trust

How to resolve the error 'fe_sendauth: no password supplied' in Rails using PostgreSQL?

My solution to this problem was to remove host: localhost from the default: group.

postgresql database migration error: PG::ConnectionBad: fe_sendauth: no password supplied

Whao... after searching more on stackoverflow, I got this question, which points to this documentation.

On following that, and configuring my .pgpass file with default username and password as said in the documentation, all worked fine!!!!

Although, I still do not understand why it was previously working for my test env database, but not the development env database.

Rails Postgres Github Actions error: PG::ConnectionBad: fe_sendauth: no password supplied

The issue is a simple omission from the configuration file: I set the env variables section for the Setup database step, but not the Run tests step. As a result, the error is correct, during that step, there is no username/password being provided so it cannot connect to the DB server. Adding it to the test step solves the problem:

- name: Run tests
run: bundle exec rake
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres


Related Topics



Leave a reply



Submit