Kasmadan (UA)
PPrisma
•Created by Kasmadan (UA) on 1/20/2025 in #help-and-questions
Prisma pulse issue
whne trying to connect pulse got this error, I also tried .stream() method, same result....
I'm using nextjs 15 with server actions
Error creating stream: [TypeError: fetch failed] {
[cause]: Error [InvalidArgumentError]: invalid upgrade header
at new Promise (<anonymous>) {
code: 'UND_ERR_INVALID_ARG'
}
}
PULSE FUNCTION
'use server';
import { prisma } from '../prisma-client';
export const getBookingStream = async () => {
try {
const stream = await prisma.booking.subscribe();
console.log('Stream created successfully', stream);
} catch (error) {
console.error('Error creating stream:', error);
}
};
CLIENT INIT
import { PrismaClient } from '@prisma/client/edge';
import { withAccelerate } from '@prisma/extension-accelerate';
import { withPulse } from '@prisma/extension-pulse/workerd';
const globalForPrisma = globalThis as unknown as { prisma: ReturnType<typeof createPrismaClient>; };
function createPrismaClient() {
return new PrismaClient().$extends(withAccelerate()).$extends(
withPulse({
apiKey: process.env.PULSE_API_KEY as string,
}),
);
}
export const prisma = globalForPrisma.prisma || createPrismaClient();
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
13 replies
PPrisma
•Created by Kasmadan (UA) on 1/14/2025 in #help-and-questions
Console prisma studio
Hello, when I run prisma studio locally everything is fine, but in the prisma studio console I get this error. Is it a bug in the console or on my side?
I get this error even with an empty database, I have asked AI and tried many different configs.... nothing helps
installHook.js:1 Error: {"error_code":"P1012","message":"\u001b[1;91merror\u001b[0m: \u001b[1mError validating: This line is not a valid field or attribute definition.\u001b[0m\n \u001b[1;94m-->\u001b[0m \u001b[4mschema.prisma:57\u001b[0m\n\u001b[1;94m | \u001b[0m\n\u001b[1;94m56 | \u001b[0mmodel Staff {\n\u001b[1;94m57 | \u001b[0m \u001b[1;91mid Int @id(map: "Staff_pkey") @default(nextval('staff_id_seq")\u001b[0m\n\u001b[1;94m58 | \u001b[0m name String\n\u001b[1;94m | \u001b[0m\n\u001b[1;91merror\u001b[0m: \u001b[1mError validating: This line is not a valid field or attribute definition.\u001b[0m\n \u001b[1;94m-->\u001b[0m \u001b[4mschema.prisma:67\u001b[0m\n\u001b[1;94m | \u001b[0m\n\u001b[1;94m66 | \u001b[0mmodel Studio {\n\u001b[1;94m67 | \u001b[0m \u001b[1;91mid Int @id(map: "Studio_pkey") @default(nextval('studio_id_seq")\u001b[0m\n\u001b[1;94m68 | \u001b[0m name String\n\u001b[1;94m | \u001b[0m\n\nValidation Error Count: 2"}
12 replies