Ruby bundle, problem with postgres authentication

Keywords: PostgreSQL - Linux - Technical issue - Credentials
bnsupport ID: 838c2dae-7625-c88b-e083-613de79ccdb8
Description:
I want bundle ruby, authentication problem
I put the postgres user and the password that is in the bitnami_credentials file, in vain. There is an authentication problem that I cannot resolve.

Hello @helder_rangel,

I’m not sure I understand your issue. Are you trying to run a command with sudo and it is asking for your user’s password or are you trying to access your PostgreSQL database? If you need your database credentials, try using root as the user and the password at /home/bitnami/bitnami_credentials.

Regards,
Francisco de Paz

The password that’s ok for:

psql -U postgres

But, this password was rejected in

bundle exec rails db:prepare
bitnami@ip-172-31-62-188:~/htdocs/backend$ bundle exec rails db:prepare
rails aborted!
ActiveRecord::ConnectionNotEstablished: FATAL:  password authentication failed for user "postgres"

Caused by:
PG::ConnectionBad: FATAL: password authentication failed for user “postgres”

Tasks: TOP => db:prepare
(See full trace by running task with --trace)`

Saw config/database.yml

vi database.yml
default: &default
  adapter: postgresql
  encoding: unicode
  username: postgres
  password: credential thats ok...
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
  <<: *default
  database: comintegrada

Hello @helder_rangel,

I haven’t been able to reproduce the issue. Following our Create A New Rails Application guide I was able to create an application and connect to the database:

sudo mkdir /opt/bitnami/projects
sudo chown $USER /opt/bitnami/projects
cd /opt/bitnami/projects
rails new testing --database postgresql
cd testing
sudo bundle exec rails db:prepare
Created database 'testing_development'
Created database 'testing_test'

To configure database.yml I obtained the database password and edited the .yml:

sudo cat /home/bitnami/bitnami_credentials 
Welcome to the Bitnami Ruby Stack

******************************************************************************
The default password is 'Ghf5EOhyYwPu'.
******************************************************************************
cat config/database.yml
...
default: &default
  adapter: postgresql
  encoding: unicode
  # For details on connection pooling, see Rails configuration guide
  # https://guides.rubyonrails.org/configuring.html#database-pooling
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  username: postgres
  password: Ghf5EOhyYwPu
  host: localhost
...

Could you compare your configuration to my example? If the password is valid to access via psql, it should work to access using rails.

Regards,
Francisco de Paz

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.