Chapter 6: Error Run php sendPushes.php

I’m stuck at this for hours and searched in forums, couldn’t find the answer.

After successfully tested notifications using HTTPie, I got some errors when Run php sendPushes.php in terminal, it says:

Fatal error: Uncaught PDOException: SQLSTATE[08006] [7] connection to server at “localhost” (::1), port 5432 failed: FATAL: password authentication failed for user “apns” in /Users/abc/Desktop/sendPushes.php:17

Stack trace:

#0 /Users/abc/Desktop/sendPushes.php(17): PDO->__construct(‘pgsql:host=loca…’)

#1 {main}

thrown in /Users/abc/Desktop/sendPushes.php on line 17

and in Docker it shows this:

webservice-db-1 | 2021-11-30 10:09:37.148 UTC [118] FATAL: password authentication failed for user “apns”
webservice-db-1 | 2021-11-30 10:09:37.148 UTC [118] DETAIL: Role “apns” does not exist.

It seems like it’s something wrong with user and password in $db = new PDO('pgsql:host=localhost;dbname=apns;user=apns;password=password'); ? But I followed the book several times and can’t find somewhere say these parameters need to be specified.

The AUTH_KEY_PATH , AUTH_KEY_ID, TEAM_ID and BUNDLE_ID have all been set correctly.

@wellwellwell First off, let me apologize for the late reply. I injured my back and have been out on medical leave. As to your issue, the problem is that the docker-compose.yml file has incorrect database connection details. If you edit that file you’ll see variables like so:

  DATABASE_NAME: vapor_database
  DATABASE_USERNAME: vapor_username
  DATABASE_PASSWORD: vapor_password

You need to modify those to have the correct values. Note that the name, username and password are set twice in the file.

I’m going to be working on an update for this book around February, and I’ll make sure to fix these missing instructions in the updated version!

@gargoyle Thanks for reply, now I could send notifications!