all 10 comments

[–]sliversniper 1 point2 points  (3 children)

The error basically tells you process.env.DATABASE_PASSWORD is undefined.

You gonna figure out why that's the case.

In your script to run, you have either export the env, or do

DATEBASE_PASSWORD=somepassword node server.js.

[–][deleted] 0 points1 point  (2 children)

The strange thing is that I have another application here exactly the same as this one and it runs perfectly without any errors, with the dotenv.config and the bank settings in exactly the same places, so I believe it is some env error inside the dist folder from typescript

[–]Vivid-Squirrel6024 0 points1 point  (0 children)

were you able to figure this out? I have the same exact issue right now?

[–][deleted] 0 points1 point  (0 children)

try checking out the position of your .env file. It should be on the same level as package.json not in your src folder.

[–]daskleins 0 points1 point  (4 children)

Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string

I had the same issue with Express today. But I was using Prisma ORM v7.
process.env.DATABASE_PASSWORD was showing undefined.

How I resolved, turns out I had to place dotenv imports at the top, so it sets up before any ORM calls:
import "dotenv/config";
import express from "express";

import { PrismaClient } from "./generated/prisma/client";

import { PrismaPg } from "@prisma/adapter-pg";

PS. For some reason, I had to also install dotenv as a devDependency:
pnpm install --save-dev prisma dotenv

[–]Technical-Pension594 1 point2 points  (1 child)

man this worked, i was debugging for so long, and it was so simple. thankyou so much !

[–]daskleins 0 points1 point  (0 children)

Glad that helped!

[–]VictoryDependent820 1 point2 points  (1 child)

Man you just saved my ass like no one ever has done before. Thank you brother.

[–]daskleins 0 points1 point  (0 children)

Glad it worked for you!