Yozamu
Yozamu
Explore posts from servers
PPrisma
Created by Yozamu on 11/23/2024 in #help-and-questions
Neon adapter (driverAdapters) gives error on PrismaClient init
Hey there. I've wanted to run inngest events that trigger some prisma stuff, but I'm getting the error
PrismaClient failed to initialize because it wasn't configured to run in this environment
PrismaClient failed to initialize because it wasn't configured to run in this environment
So I've decided to take a look at the driver adapters. After following the setup page to update my existing code, I have the following prisma client file :
import { Pool, neonConfig } from '@neondatabase/serverless';
import { PrismaNeon } from '@prisma/adapter-neon';
import dotenv from 'dotenv';
import ws from 'ws';

dotenv.config();
neonConfig.webSocketConstructor = ws;
const connectionString = `${process.env.DATABASE_URL}`;
const pool = new Pool({ connectionString });
const adapter = new PrismaNeon(pool);

const prismaClientSingleton = () => {
return new PrismaClient({ adapter });
};

declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

const prisma = globalThis.prismaGlobal ?? prismaClientSingleton();

export default prisma;

if (process.env.NODE_ENV !== 'production') globalThis.prismaGlobal = prisma;
import { Pool, neonConfig } from '@neondatabase/serverless';
import { PrismaNeon } from '@prisma/adapter-neon';
import dotenv from 'dotenv';
import ws from 'ws';

dotenv.config();
neonConfig.webSocketConstructor = ws;
const connectionString = `${process.env.DATABASE_URL}`;
const pool = new Pool({ connectionString });
const adapter = new PrismaNeon(pool);

const prismaClientSingleton = () => {
return new PrismaClient({ adapter });
};

declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

const prisma = globalThis.prismaGlobal ?? prismaClientSingleton();

export default prisma;

if (process.env.NODE_ENV !== 'production') globalThis.prismaGlobal = prisma;
Unfortunately, it seems like there's an error when initializing the PrismaClient:
Property 'startTransaction' is missing in type 'PrismaNeon' but required in type 'DriverAdapter'.
Property 'startTransaction' is missing in type 'PrismaNeon' but required in type 'DriverAdapter'.
I haven't been able to find much clues about what's going on. Any idea?
5 replies
CDCloudflare Developers
Created by Yozamu on 5/24/2024 in #general-help
Questions about CORS and R2 usage
Hello, I've started using CloudFlare with R2 today. I've added my site to be able to add it as custom domain for my bucket. However there are two points I'm worried about: - I don't want my bucket to be accessed from anywhere and would prefer to allow only some origins to access it. I've tried to set a CORS policy, but it doesn't seem to get applied. Any idea why ? - I'm also worried about the analytics part, both global and R2-related. It seems I've already had 670 requests overall, and 169 + 209 operations of class A and B respectively. Which seems a bit weird to me since I'm the only one accessing the data right now, and there are only a few dozen files uploaded... Hence I'm not sure how I could've reached that numbers Any hint is appreciated
9 replies