Failed to parse syntax of config file
Hi everyone,
I get this error when executing
pnpm prisma generate:
My prisma.config.ts file looks as follows:
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
You chose to compile with the bot. One moment while I piece together your answer…
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
There is no
The correct way to access environment variables is via
Your config should use either
- Remove the
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:
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-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.
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