Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: db:push - error: password authentication failed for user "postgres" #1853

Closed
NoamBechhofer opened this issue Apr 27, 2024 · 1 comment · Fixed by #1868
Closed

bug: db:push - error: password authentication failed for user "postgres" #1853

NoamBechhofer opened this issue Apr 27, 2024 · 1 comment · Fixed by #1868

Comments

@NoamBechhofer
Copy link

NoamBechhofer commented Apr 27, 2024

Provide environment information

 System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics
    Memory: 699.57 MB / 7.33 GB
  Binaries:
    Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
    npm: 9.6.7 - ~\AppData\Roaming\npm\npm.CMD
    pnpm: 9.0.6 - ~\AppData\Roaming\npm\pnpm.CMD

Describe the bug

after using /start-databse.sh, when running pnpm db:push, the following issues is encountered:

$ pnpm db:push

> my_app@0.1.0 db:push C:\Users\noamb\OneDrive\Documents\Programming\full_stack_web_dev\my_app
> drizzle-kit push:pg

drizzle-kit: v0.20.17
drizzle-orm: v0.29.5

No config path provided, using default path
Reading config file 'C:\Users\noamb\OneDrive\Documents\Programming\full_stack_web_dev\my_app\drizzle.config.ts'
C:\Users\noamb\OneDrive\Documents\Programming\full_stack_web_dev\my_app\node_modules\.pnpm\drizzle-kit@0.20.17\node_modules\drizzle-kit\bin.cjs:42528
        const message = name === "notice" ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name); 
                                                                                                 ^

error: password authentication failed for user "postgres"
    at Parser.parseErrorMessage (C:\Users\noamb\OneDrive\Documents\Programming\full_stack_web_dev\my_app\node_modules\.pnpm\drizzle-kit@0.20.17\node_modules\drizzle-kit\bin.cjs:42528:98)
    at Parser.handlePacket (C:\Users\noamb\OneDrive\Documents\Programming\full_stack_web_dev\my_app\node_modules\.pnpm\drizzle-kit@0.20.17\node_modules\drizzle-kit\bin.cjs:42369:25)
    at Parser.parse (C:\Users\noamb\OneDrive\Documents\Programming\full_stack_web_dev\my_app\node_modules\.pnpm\drizzle-kit@0.20.17\node_modules\drizzle-kit\bin.cjs:42293:34)
    at Socket.<anonymous> (C:\Users\noamb\OneDrive\Documents\Programming\full_stack_web_dev\my_app\node_modules\.pnpm\drizzle-kit@0.20.17\node_modules\drizzle-kit\bin.cjs:42569:44)
    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 TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
  length: 104,
  severity: 'FATAL',
  code: '28P01',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'auth.c',
  line: '326',
  routine: 'auth_failed'
}

Node.js v20.11.1
 ELIFECYCLE  Command failed with exit code 1.

Reproduction repo

https://github.com/NoamBechhofer/t3-repro

To reproduce

$ pnpm create t3-app@latest

Select tailwind, trpc, nextauth, drizzle, app router, postgres
Set the discord auth details in the .env

$ ./start-database.sh 

Have the script generate the password randomly

$ pnpm db:push

This is where the error occurs

Additional information

No response

@Exotica0122
Copy link
Contributor

I had the same issue but I fixed it by adding the POSTGRES_USER myself at the end of the start-databse.sh file.

docker run -d \
  --name $DB_CONTAINER_NAME \
  -e POSTGRES_USER="postgres" \
  -e POSTGRES_PASSWORD="$DB_PASSWORD" \
  -e POSTGRES_DB=osu-chat \
  -p 5432:5432 \
  docker.io/postgres && echo "Database container '$DB_CONTAINER_NAME' was successfully created"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants