Failed to parse config file at "./prisma.config.ts" when using an adapter

I followed this guide exactly: https://www.prisma.io/docs/guides/cloudflare-d1 and on step 4.3, I get the error: Failed to parse syntax of config file at "./prisma.config.ts" I tried changing the env variables to hard coded strings to see if that was the issue, but same error.
How to use Prisma ORM with Cloudflare D1 | Prisma Documentation
Learn how to use Prisma ORM with Cloudflare D1
2 Replies
Prisma AI Help
You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.
Lunorien
LunorienOP2w ago
I tried using both 6.11.0 and 6.19.0 actually, just tried 6.11.0 with this and it worked:
import { PrismaD1 } from "@prisma/adapter-d1"
import "dotenv/config"

export default {
earlyAccess: true,
schema: "./prisma/schema.prisma",
migrate: {
adapter: async () => {
return new PrismaD1({
CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN!,
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID!,
CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID!,
})
},
},
}
import { PrismaD1 } from "@prisma/adapter-d1"
import "dotenv/config"

export default {
earlyAccess: true,
schema: "./prisma/schema.prisma",
migrate: {
adapter: async () => {
return new PrismaD1({
CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN!,
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID!,
CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID!,
})
},
},
}
but this doesent work no matter what:
import type { PrismaConfig } from 'prisma';
import { PrismaD1 } from '@prisma/adapter-d1';

// import your .env file
import 'dotenv/config';

export default {
experimental: {
adapter: true,
},
schema: 'prisma/schema.prisma',
async adapter() {
return new PrismaD1({
CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN!,
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID!,
CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID!,
});
},
} satisfies PrismaConfig;
import type { PrismaConfig } from 'prisma';
import { PrismaD1 } from '@prisma/adapter-d1';

// import your .env file
import 'dotenv/config';

export default {
experimental: {
adapter: true,
},
schema: 'prisma/schema.prisma',
async adapter() {
return new PrismaD1({
CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN!,
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID!,
CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID!,
});
},
} satisfies PrismaConfig;
Seems like the fix it to add: engine: "js",

Did you find this page helpful?