-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Hi @ikalnytskyi 👋 hope things are good with you!
We're running into a very confusing issue with the action, where environment variables which we set in our workflow are somehow disappearing:
name: CI
on: push
jobs:
ci:
name: CI
runs-on: windows-latest
timeout-minutes: 20
env:
PGHOST: localhost
PGDATABASE: preflight_test_project_next_js_passing
PGUSERNAME: preflight_test_project_next_js_passing
# 💥 This environment variable is disappearing
PGPASSWORD: preflight_test_project_next_js_passing
steps:
- uses: ikalnytskyi/action-setup-postgres@v5
with:
username: ${{ env.PGUSERNAME }}
password: ${{ env.PGPASSWORD }}
database: ${{ env.PGDATABASE }}
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 'latest'
# Use the official setup-node action (sets up Node.js):
# https://github.com/actions/setup-node
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- run: node db.jsOur db.js file:
import postgres from 'postgres';
// Connect to database using environment variables
// https://github.com/porsager/postgres#environmental-variables
const sql = postgres();
console.log(
await sql`
SELECT
1
`,
);
await sql.end();This results in "password authentication failed for user" error messages:
Run node db.js
node db.js
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
env:
PGHOST: localhost
PGDATABASE: preflight_test_project_next_js_passing
PGUSERNAME: preflight_test_project_next_js_passing
PGPASSWORD:
PQ_LIB_DIR: C:\Program Files\PostgreSQL\14\lib
PGROOT:
PGDATA:
PGBIN:
PGUSER:
PGSERVICEFILE: D:\a\_temp/pgdata/pg_service.conf
PNPM_HOME: C:\Users\runneradmin\setup-pnpm\node_modules\.bin
node:internal/process/esm_loader:34
internalBinding('errors').triggerUncaughtException(
^
PostgresError: password authentication failed for user "preflight_test_project_next_js_passing"
at ErrorResponse (file:///D:/a/preflight-test-project-next-js-passing/preflight-test-project-next-js-passing/node_modules/.pnpm/postgres@3.4.4/node_modules/postgres/src/connection.js:788:[2](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8526965282/job/23357327414?pr=152#step:8:2)6)
at handle (file:///D:/a/preflight-test-project-next-js-passing/preflight-test-project-next-js-passing/node_modules/.pnpm/postgres@[3](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8526965282/job/23357327414?pr=152#step:8:3).4.4/node_modules/postgres/src/connection.js:474:6)
at Socket.data (file:///D:/a/preflight-test-project-next-js-passing/preflight-test-project-next-js-passing/node_modules/.pnpm/postgres@3.[4](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8526965282/job/23357327414?pr=152#step:8:4).4/node_modules/postgres/src/connection.js:31[5](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8526965282/job/23357327414?pr=152#step:8:5):9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at cachedError (file:///D:/a/preflight-test-project-next-js-passing/preflight-test-project-next-js-passing/node_modules/.pnpm/postgres@3.4.4/node_modules/postgres/src/query.js:170:23)
at new Query (file:///D:/a/preflight-test-project-next-js-passing/preflight-test-project-next-js-passing/node_modules/.pnpm/postgres@3.4.4/node_modules/postgres/src/query.js:3[6](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8526965282/job/23357327414?pr=152#step:8:6):24)
at sql (file:///D:/a/preflight-test-project-next-js-passing/preflight-test-project-next-js-passing/node_modules/.pnpm/postgres@3.4.4/node_modules/postgres/src/index.js:112:11)
at file:///D:/a/preflight-test-project-next-js-passing/preflight-test-project-next-js-passing/db.js:10:12 {
severity_local: 'FATAL',
severity: 'FATAL',
code: '2[8](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8526965282/job/23357327414?pr=152#step:8:8)P01',
file: 'auth.c',
line: '338',
routine: 'auth_failed'
}
Node.js v20.[11](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8526965282/job/23357327414?pr=152#step:8:11).1
Error: Process completed with exit code 1.
Logging out the process.env shows that the environment variable PGPASSWORD is missing:
PGHOST localhost
PGUSERNAME preflight_test_project_next_js_passing
PGPASSWORD
PGDATABASE preflight_test_project_next_js_passing
Not present on non-Windows OSes
This script runs fine on other non-Windows OSes 🤔
Not relying on environment variables works
Also, on Windows, when not relying on the environment variables, then our script runs through:
// This version works:
const sql = postgres(
'postgres://preflight_test_project_next_js_passing:preflight_test_project_next_js_passing@localhost:5432/preflight_test_project_next_js_passing',
);
Is it possible that the action is actually manipulating environment variables that are being explicitly set by the user in the workflow? (but only on Windows?)
If so, this is very confusing and surprising behavior.
Metadata
Metadata
Assignees
Labels
No labels