PrismaP
Prismaβ€’8mo agoβ€’
11 replies
AmazingViegas

Prisma hanging on cloudflare

Hello! I am using Prisma ORM on cloudflare workers and I am seeing quite a strange error:
The Workers runtime canceled this request because it detected that your Worker's code had hung and would never generate a response.


Is this some known prisma issue on cloudflare edge runtime? Never happened before in Verce serverless afaik.
Any help would be useful, thank you so much in advance. πŸ˜„

This is my worker code:
export const getChat = createServerFn()
  .middleware([authenticatedMiddleware])
  .validator(z.string())
  .handler(async ({ data, context }) => {
    const chat = await database.chat.findUnique({
      where: {
        id: data,
      },
      include: {
        messages: {
          orderBy: {
            createdAt: "asc",
          },
        },
      },
    });
    if (!chat) {
      throw Error(`Chat with id ${data} not found`);
    }
    if (chat.userId !== context.userId) {
      throw Error("Unauthorized access to chat");
    }
    return chat;
  });
Was this page helpful?