convex-backend
convex-backend copied to clipboard
Dynamic require of "stream" is not supported
import { headers } from "next/headers";
import Stripe from "stripe";
import { ConvexHttpClient } from "convex/browser";
import { stripe } from "@/lib/stripe";
import { env } from "process";
import { api } from "../../../../../convex/_generated/api";
const convex = new ConvexHttpClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
export async function POST(req: Request) {
const body = await req.text();
const signature = headers().get("Stripe-Signature") as string;
if (!env.STRIPE_WEBHOOK_SECRET) {
return new Response("Missing STRIPE_WEBHOOK_SECRET", { status: 500 });
}
let event: Stripe.Event;
throws
Call Stack
eval
node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected][email protected]__react-do_a6pe3624vgfhu2tivlhxgo7czi\node_modules\convex\dist\esm\browser\simple_client-node.js (12:1)
../common/temp/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/ws/lib/stream.js
node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected][email protected]__react-do_a6pe3624vgfhu2tivlhxgo7czi\node_modules\convex\dist\esm\browser\simple_client-node.js (38:20)
Ok fixed it by changing to:
const response = await fetch(
`${process.env.NEXT_PUBLIC_CONVEX_URL}/api/query?path=users:getUserByClerkId`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
args: { clerkId: userId },
}),
}
);
I'll leave the ticket open as the issue stands with the package
More specific repro steps would be appreciated! If you could make a little repo that reproes the issue and link it, that would be best.