Skip to content

Cannot connect to Postgres Database #5860

@JalenEvans

Description

@JalenEvans

Bug report info

act version:            0.2.78
GOOS:                   windows
GOARCH:                 amd64
NumCPU:                 20
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        \\.\pipe\docker_engine(broken)
Config files:
        C:\Users\redfl\AppData\Local\act\actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.24.3
        Module path:           github.com/nektos/act
        Main version:          v0.2.78
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.78 -X main.commit=810650272619ddb0d3c8aff56fa5e9439aca9fb6 -X main.date=2025-06-01T02:48:07Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 windows
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         810650272619ddb0d3c8aff56fa5e9439aca9fb6
                vcs.time:             2025-06-01T02:47:45Z
                vcs.modified:         false
Docker Engine:
        Engine version:        28.1.1
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlayfs
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:
        OS arch:               x86_64
        OS kernel:             6.6.87.2-microsoft-standard-WSL2
        OS CPU:                20
        OS memory:             7803 MB
        Security options:
                name=seccomp,profile=unconfined
                name=cgroupns

Command used with act

act --workflows ".github/workflows/backend-tests.yml" --secret-file "c:\Users\user\Desktop\Coding Projects\Wins Per Minute\wins-per-minute-backend\.env" --var-file "" --input-file "" --eventpath ""

Describe issue

Background

I am new to GitHub Actions in general and found this recently to test my workflows locally before I commit and push them to use in my CI. I am using the VS Code extension (GituHb Local Actions) apposed to the CLI.
The stack I am currently using is React, Express, Node.js, and PostgresSQL. This is my first time using any of these technologies so I may not be able to help much with questions.
The current workflow I am having issues with is testing API endpoints through my express server and Postgres database with Jest.

The Issue

I believe I have everything correct in my workflow (have googled plenty and had ChatGPT look through it also) but whenever I run it through the extension it fails for the reason stated below.
Inspecting of the Docker Container while its running has shown that my secrets and .env variables are passing correctly and are what they should be.

If anyone has any insight or solutions they would be much appreciated. Thank you.

Link to GitHub repository

https://github.com/JalenEvans/Wins-Per-Minute

Workflow content

name: Backend Tests

on:
  push:
  pull_request:
    branches: [ "main" ]

env:
    PORT: ${{ secrets.PORT }}
    NODE_ENV: ${{ secrets.NODE_ENV }}
    TEST_DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}

jobs:
  build:

    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:17
        ports:
          - 5432:5432
        env:
          PGUSER: my_user
          POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
          POSTGRES_DB: ${{ secrets.TEST_DB_NAME }}
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    strategy:
      matrix:
        node-version: [22.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v4
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
        cache-dependency-path: wins-per-minute-backend/package-lock.json

    - name: Install dependencies
      run: npm ci
      working-directory: wins-per-minute-backend

    - name: Install netcat
      run: sudo apt-get update && sudo apt-get install -y netcat
      working-directory: wins-per-minute-backend
    
    - name: Start server
      run: |
        node server.js &
        for i in {1..10}; do
          if nc -z localhost $PORT; then
            echo "Server is up!"
            break
          fi
          echo "Waiting for server..."
          sleep 2
        done
      working-directory: wins-per-minute-backend
    
    - name: Run backend tests
      run: node --experimental-vm-modules node_modules/jest/bin/jest.js
      working-directory: wins-per-minute-backend

Relevant log output

[Backend Tests/build] ⭐ Run Main Start server
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[Backend Tests/build] [DEBUG] Extracting content to '/var/run/act'
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Wrote command 

node server.js &
for i in {1..10}; do
  if nc -z localhost $PORT; then
    echo "Server is up!"
    break
  fi
  echo "Waiting for server..."
  sleep 2
done


 to 'workflow/4'
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/4 len:159
[Backend Tests/build] [DEBUG] Extracting content to '/var/run/act'
[Backend Tests/build]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/4] user= workdir=wins-per-minute-backend
[Backend Tests/build] [DEBUG] Exec command '[bash -e /var/run/act/workflow/4]'
[Backend Tests/build] [DEBUG] Working directory '/mnt/c/Users/redfl/Desktop/Coding Projects/Wins Per Minute/wins-per-minute-backend'
| Waiting for server...
| Server is running on http://localhost:***
| Server is using environment: ***
| Database URL is: postgres://***:***@localhost:5432/***
| Server is up!
[Backend Tests/build]   ✅  Success - Main Start server [2.2798581s]
[Backend Tests/build] ⭐ Run Main Run backend tests
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[Backend Tests/build] [DEBUG] Extracting content to '/var/run/act'
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Wrote command 

node --experimental-vm-modules node_modules/jest/bin/jest.js

 to 'workflow/5'
[Backend Tests/build] [DEBUG] Writing entry to tarball workflow/5 len:62
[Backend Tests/build] [DEBUG] Extracting content to '/var/run/act'
[Backend Tests/build]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/5] user= workdir=wins-per-minute-backend
[Backend Tests/build] [DEBUG] Exec command '[bash -e /var/run/act/workflow/5]'
[Backend Tests/build] [DEBUG] Working directory '/mnt/c/Users/redfl/Desktop/Coding Projects/Wins Per Minute/wins-per-minute-backend'
| (node:599) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
| (Use `node --trace-warnings ...` to show where the warning was created)
  console.log
|     Server is running on http://localhost:***
|
|       at Server.<anonymous> (server.js:27:17)
|
  console.log
|     Server is using environment: ***
|
|       at Server.<anonymous> (server.js:28:17)
|
  console.log
|     Database URL is: postgres://***:***@localhost:5432/***
|
|       at Server.<anonymous> (server.js:29:17)
|
  console.error
|     🔥 Error in route: {
|       message: 'SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string',
|       stack: 'Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string\n' +
|         '    at /mnt/c/Users/redfl/Desktop/Coding Projects/Wins Per Minute/wins-per-minute-backend/node_modules/pg-pool/index.js:45:11\n' +
|         '    at processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
|         '    at findUserByEmail (/mnt/c/Users/redfl/Desktop/Coding Projects/Wins Per Minute/wins-per-minute-backend/models/userModel.js:16:17)\n' +   
|         '    at register (/mnt/c/Users/redfl/Desktop/Coding Projects/Wins Per Minute/wins-per-minute-backend/controllers/authController.js:24:30)',   
|       name: 'Error'
|     }
|
|       15 |
|       16 | export function errorHandler(err, req, res, next) {
|     > 17 |     console.error('🔥 Error in route:', {
|          |             ^
|       18 |         message: err.message,
|       19 |         stack: err.stack,
|       20 |         name: err.name,
|
|       at errorHandler (middleware/errorHandler.js:17:13)
|       at Layer.handleError (node_modules/router/lib/layer.js:116:17)
|       at trimPrefix (node_modules/router/index.js:340:13)
|       at node_modules/router/index.js:297:9
|       at processParams (node_modules/router/index.js:582:12)
|       at next (node_modules/router/index.js:291:5)
|       at node_modules/router/index.js:688:15
|       at next (node_modules/router/index.js:276:14)
|       at next (node_modules/router/lib/route.js:132:14)
|       at register (controllers/authController.js:36:9)
|
|  FAIL  tests/authRoutes.test.js
|   Authentication Routes
|     POST /register
|       ✕ should return a status code of 201 with a token and create a new user (1 ms)
|       ✕ should return a status code of 409 if the user is already created
|     POST /login
|       ✕ should return a status code of 200 with a token and log in a user
|       ✕ should return a status code of 401 if the user inputed invalid credentials
|
|   ● Authentication Routes › POST /register › should return a status code of 201 with a token and create a new user
|
|     SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
|
|       23 |
|       24 | beforeAll(async () => {
|     > 25 |     await pool.query(`TRUNCATE TABLE users RESTART IDENTITY CASCADE`);
|          |     ^
|       26 |
|       27 |     process.on('unhandledRejection', (reason) => {
|       28 |         console.error('Unhandled rejection:', reason);
|
|       at node_modules/pg-pool/index.js:45:11
|       at Object.<anonymous> (tests/authRoutes.test.js:25:5)
|
|   ● Authentication Routes › POST /register › should return a status code of 409 if the user is already created
|
|     SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
|
|       23 |
|       24 | beforeAll(async () => {
|     > 25 |     await pool.query(`TRUNCATE TABLE users RESTART IDENTITY CASCADE`);
|          |     ^
|       26 |
|       27 |     process.on('unhandledRejection', (reason) => {
|       28 |         console.error('Unhandled rejection:', reason);
|
|       at node_modules/pg-pool/index.js:45:11
|       at Object.<anonymous> (tests/authRoutes.test.js:25:5)
|
|   ● Authentication Routes › POST /login › should return a status code of 200 with a token and log in a user
|
|     SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
|
|       23 |
|       24 | beforeAll(async () => {
|     > 25 |     await pool.query(`TRUNCATE TABLE users RESTART IDENTITY CASCADE`);
|          |     ^
|       26 |
|       27 |     process.on('unhandledRejection', (reason) => {
|       28 |         console.error('Unhandled rejection:', reason);
|
|       at node_modules/pg-pool/index.js:45:11
|       at Object.<anonymous> (tests/authRoutes.test.js:25:5)
|
|   ● Authentication Routes › POST /login › should return a status code of 401 if the user inputed invalid credentials
|
|     SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
|
|       23 |
|       24 | beforeAll(async () => {
|     > 25 |     await pool.query(`TRUNCATE TABLE users RESTART IDENTITY CASCADE`);
|          |     ^
|       26 |
|       27 |     process.on('unhandledRejection', (reason) => {
|       28 |         console.error('Unhandled rejection:', reason);
|
|       at node_modules/pg-pool/index.js:45:11
|       at Object.<anonymous> (tests/authRoutes.test.js:25:5)
|
Test Suites: 1 failed, 1 total
| Tests:       4 failed, 4 total
| Snapshots:   0 total
| Time:        0.768 s
| Ran all test suites.
| Jest did not exit one second after the test run has completed.
| 
| 'This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
[Backend Tests/build] Reevaluate condition  due to cancellation
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] Loading revision from git directory
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] HEAD points to '6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a'
[Backend Tests/build] [DEBUG] using github ref: refs/heads/Workflows
[Backend Tests/build] [DEBUG] Found revision: 6b3dff1afa53cc2463e5bb5c8a30f23b70eec96a
[Backend Tests/build] [DEBUG] evaluating expression ''
[Backend Tests/build] [DEBUG] expression '' evaluated to 'false'
[Backend Tests/build] Result condition keepStepRunning=false
[Backend Tests/build]   ❌  Failure - Main Run backend tests [4m0.1920077s]

Additional information

Only included the verbose outputs Start server & Run backend tests. If any more logs are requested I will gladly provide them.
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions