Failed to parse config file at "./prisma.config.ts"
Following the D1 guide here https://www.prisma.io/docs/guides/cloudflare-d1. When trying to migrate by running
npx prisma migrate dev --name init
, I get the error failing to parse the config file3 Replies
You chose to compile with the bot. One moment while I piece together your answer…
If you're seeing "Failed to parse config file at './prisma.config.ts'" when running
Ensure your
See example in the official guide. 2. Missing or Incorrect Environment Variables
The adapter function expects certain environment variables. Make sure your
Ensure you are using Prisma ORM v6.11.0 or later, as earlier versions may not support the D1 adapter or the config file format as shown. 4. File Location and Path Resolution
The CLI resolves paths relative to the config file location. Make sure your
[See path resolution details](https://www.prisma.io/docs/orm/referenc e/prisma-config-reference#path-resolution). If you still encounter parsing errors, double-check for typos or misplaced commas/brackets in your config file. If the error persists, please provide the exact error message and your
npx prisma migrate dev --name init
while following the Cloudflare D1 guide, the most common causes are:
1. Syntax or Export Issues in prisma.config.ts
Ensure your
prisma.config.ts
is using a valid default export and matches the expected structure. For D1, it should look like this:
Make sure you are not using CommonJS (module.exports
) and that your file is valid TypeScript/ESM syntax.See example in the official guide. 2. Missing or Incorrect Environment Variables
The adapter function expects certain environment variables. Make sure your
.env
file contains:
and that you are loading them with import 'dotenv/config'
at the top of your config file.
3. Prisma Version CompatibilityEnsure you are using Prisma ORM v6.11.0 or later, as earlier versions may not support the D1 adapter or the config file format as shown. 4. File Location and Path Resolution
The CLI resolves paths relative to the config file location. Make sure your
prisma.config.ts
is in the project root and your schema path is correct.[See path resolution details](https://www.prisma.io/docs/orm/referenc e/prisma-config-reference#path-resolution). If you still encounter parsing errors, double-check for typos or misplaced commas/brackets in your config file. If the error persists, please provide the exact error message and your
prisma.config.ts
content for more targeted help.
Reference: Cloudflare D1 migration guide
🤔 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.Hey!
Is this occuring on latest prisma version 6.13.0?
Hello! These are the prisma versions installed
Hmm I've updated to 6.13.0 but still getting the same error
Copy of my prisma.config.ts
which should be the same as what's in the Prisma D1 doc