PrismaP
Prisma2mo ago
9 replies
Magstar

Prisma V7 Error: Client Password must be a string

Hey! I am sorry if it's asked already, I just migrated to Prisma V7 and am stuck with an unsolvable error.

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


The server runs fine, Though the error only occurs when i change the database using Prisma on API calls.

I have verified the version of prisma client, Prisma and Prisma adapter, All are V 7.01.

This is how I initialize prisma:

import { PrismaClient } from "../../generated/prisma/client.js";
import { PrismaPg } from "@prisma/adapter-pg";
import dotenv from "dotenv";

const adapter = new PrismaPg({
    connectionString: process.env.DATABASE_URL
});

const prismaClientSingleton = () => {
    dotenv.config();
    console.log("DATABASE_URL =", process.env.DATABASE_URL);
    return new PrismaClient({
        adapter: adapter
    });
};
declare const globalThis: {
    prismaGlobal: ReturnType<typeof prismaClientSingleton>
} & typeof global;

const prisma: PrismaClient = globalThis.prismaGlobal ?? prismaClientSingleton();

if (process.env.NODE_ENV !== "production") {
    globalThis.prismaGlobal = prisma;
};

export default prisma;


My Prisma.config:
import { defineConfig, env } from "prisma/config";
import "dotenv/config";

export default defineConfig({
    schema: "prisma/schema.prisma",
    migrations: {
        path: "prisma/migrations"
    },
    datasource: {
        url: env("DATABASE_URL"),
        shadowDatabaseUrl: env("DIRECT_URL")
    }
});


I have made sure My DB URL isnt null:
> server@1.0.0 dev
> nodemon start

[nodemon] 3.1.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node start dist/index.js`
[dotenv@17.2.2] injecting env (9) from .env -- tip: 📡 version env with Radar: https://dotenvx.com/radar
DATABASE_URL = postgresql://postgres:EducatorSQLSchool@localhost:5432/authentication_fullstack


All help would be appreciated!
Was this page helpful?