1

I was working with Prisma and NestJS and it is fine but when I updated Prisma to version 7 I started getting errors, fixed them, but I am stuck with this one.

Part of schema:

datasource db { provider = "postgresql" } generator client { provider = env("CLIENT_PROVIDER") } model User { userId Int @id @default(autoincrement()) @map("user_id") name String email String @unique password String status String @default("ACTIVE") isSuperAdmin Boolean @default(false) @map("is_super_admin") createdAt DateTime @default(now()) @map("created_at") otps Otp[] auditLogs AuditLog[] @@map("users") @@index([name]) } 

Prisma service:

import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common'; import { PrismaClient } from '@prisma/client'; @Injectable() export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy { async onModuleInit() { await this.$connect(); } async onModuleDestroy() { await this.$disconnect(); } } 

Prisma module:

import { Global, Module } from '@nestjs/common'; import { PrismaService } from './prisma.service'; @Global() @Module({ providers: [PrismaService], exports: [PrismaService], }) export class PrismaModule {} 

Prisma config:

import { defineConfig, env } from "@prisma/config"; import dotenv from "dotenv"; import path from "path"; dotenv.config({ path: path.resolve(process.cwd(), ".env") }); export default defineConfig({ schema: "src/shared/database/prisma/schema.prisma", datasource: { url: env("DATABASE_URL"), }, }); 

and the error:

npm run start > [email protected] start > nest start (node:127213) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated. (Use `node --trace-deprecation ...` to show where the warning was created) [Nest] 127247 - 11/23/2025, 1:56:22 PM LOG [NestFactory] Starting Nest application... [Nest] 127247 - 11/23/2025, 1:56:22 PM ERROR [ExceptionHandler] TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received undefined 

1 Answer 1

0

According to https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-7

Change dotenv import from

import dotenv from "dotenv"; dotenv.config({ path: path.resolve(process.cwd(), ".env") }); 

To:

import 'dotenv/config'; 

Example:

import 'dotenv/config'; import { defineConfig, env } from 'prisma/config'; export default defineConfig({ schema: './schema.prisma', datasource: { url: env('DATABASE_URL') } }); 

Also, you have to change your PrismaService and call pg adapter. Check this out: https://docs.nestjs.com/recipes/prisma#use-prisma-client-in-your-nestjs-services

Sign up to request clarification or add additional context in comments.

1 Comment

For anyone still stuck,I eventually rolled Prisma back to v6 and everything started working again. The issue seems to be caused by Prisma 7’s new config system and the NestJS integration changes. My existing PrismaService and config setup worked perfectly on v6, but upgrading to v7 caused runtime errors like "paths[1] must be a string" even after fixing the dotenv import and adjusting the schema configuration. So for now, the working solution is simply downgrading Prisma back to v6 until the Prisma team releases an official fix or clearer migration path.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.