P
Prisma4w ago
Tim

Failed to parse syntax of config file

Hi everyone, I get this error when executing pnpm prisma generate:
Failed to parse syntax of config file at "<PATH>/prisma.config.ts"
Failed to parse syntax of config file at "<PATH>/prisma.config.ts"
My prisma.config.ts file looks as follows:
import { PrismaPg } from '@prisma/adapter-pg'
import 'dotenv/config'
import type { PrismaConfig } from 'prisma'
import { env } from 'prisma/config'

export default {
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
seed: 'tsx prisma/seed.ts',
},
engine: 'js',
async adapter() {
return new PrismaPg({ connectionString: env('DATABASE_URL') })
},
} satisfies PrismaConfig
import { PrismaPg } from '@prisma/adapter-pg'
import 'dotenv/config'
import type { PrismaConfig } from 'prisma'
import { env } from 'prisma/config'

export default {
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
seed: 'tsx prisma/seed.ts',
},
engine: 'js',
async adapter() {
return new PrismaPg({ connectionString: env('DATABASE_URL') })
},
} satisfies PrismaConfig
This seems to be related to switching the engine from 'classic to 'js' (I'm running into issues with Docker compose so I wanted to give the new engine option a try). Maybe the adapter is not correctly set up? I'm having a hard time figuring out how to configure this with the PostgreSQL-Adapter correctly... the error message doesn't really say anything. In the TypeScript definitions, every property is optional.
4 Replies
Prisma AI Help
You chose to compile with the bot. One moment while I piece together your answer…
Prisma AI Help
The error "Failed to parse syntax of config file at <PATH>/prisma.config.ts" is likely due to invalid or unsupported properties in your config file, or incorrect usage of the Prisma config API. Key issues in your config: 1. Unsupported engine property:
There is no engine property in the Prisma config file interface. The config should not include engine: 'js'. Engine selection is handled via the engineType property in your generator client block in schema.prisma, not in prisma.config.ts see docs. 2. Incorrect import of env:
The correct way to access environment variables is via process.env, especially after importing dotenv/config. The prisma/config module does not export an env function. You should use process.env.DATABASE_URL see example. 3. Config structure:
Your config should use either defineConfig or the satisfies PrismaConfig pattern, but the properties must match the supported options. Here’s a corrected example:
import { PrismaPg } from '@prisma/adapter-pg'
import 'dotenv/config'
import { defineConfig } from 'prisma/config'

export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
seed: 'tsx prisma/seed.ts',
},
experimental: { adapter: true },
async adapter() {
return new PrismaPg({ connectionString: process.env.DATABASE_URL })
},
})

import { PrismaPg } from '@prisma/adapter-pg'
import 'dotenv/config'
import { defineConfig } from 'prisma/config'

export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
seed: 'tsx prisma/seed.ts',
},
experimental: { adapter: true },
async adapter() {
return new PrismaPg({ connectionString: process.env.DATABASE_URL })
},
})

Summary:
- Remove the engine property from your config. - Use process.env.DATABASE_URL for environment variables. - Use defineConfig for better type safety. - Make sure your schema.prisma generator block sets engineType = "client" if you want the JS engine. For more details, see the [Prisma Config reference](<https://www.prisma.io/docs/orm/reference/
Reference | Prisma Documentation
Reference for Prisma Client API, Prisma CLI, errors & more.
Prisma AI Help
prisma-config-reference#options-reference>) and common patterns. 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Nurul
Nurul3w ago
Does the error go away if you change engine to 'classic'? Either way, could you please create a GitHub Issue using this link so that I can raise it with ORM team? https://github.com/prisma/prisma/issues
GitHub
prisma/prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - prisma/prisma

Did you find this page helpful?