await ctx.request.arrayBuffer()Buffer, not an ArrayBuffer... How about Stripe.createHttpFetch() or whatever the method is? I'm not at my compooter rn but they show it in the blog post that announced stripe+workers
The package "crypto" wasn't found on the file system but is built into node (also happens with fs and path)/functions/hello.js file in the root of the project that looks like this: npx wrangler pages dev and then went to http://localhost:8788/hello I would just see "Hello, world!" but instead of that I see the 404 page of my frontend app.wrangler pages functions build works fine./functions folder
BufferArrayBufferStripe.createHttpFetch()The package "crypto" wasn't found on the file system but is built into node/functions/hello.jsexport function onRequest(context) {
return new Response("Hello, world!");
}npx wrangler pages devhttp://localhost:8788/hello{
"baseURL": "/",
"routes": [
{
"method": "",
"module": [
"hello.js:onRequest"
],
"mountPath": "/",
"routePath": "/hello"
}
]
}wrangler pages functions build/functionsconst { request, env } = context;
const rawBody = await request.arrayBuffer()
const stripeSignature = request.headers.get('stripe-signature')
const event = await stripe.webhooks.constructEventAsync(rawBody, stripeSignature, env.STRIPE_WEBHOOK_SECRET)Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the _raw_ request body.PPayload was provided as a parsed JavaScript object instead.
Signature verification is impossible without access to the original signed material.
Learn more about webhook signing and explore webhook integration examples for various frameworks at https://github.com/stripe/stripe-node#webhook-signingconst { request, env } = context;
const rawBody = await request.text()
const stripeSignature = request.headers.get('stripe-signature')
const event = await stripe.webhooks.constructEventAsync(rawBody, stripeSignature, env.STRIPE_WEBHOOK_SECRET)const { request, env } = context;
const rawBody = await request.text()
const stripeSignature = request.headers.get('stripe-signature')
const event = await stripe.webhooks.constructEventAsync(rawBody, stripeSignature, env.STRIPE_WEBHOOK_SECRET)No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? ╮
If a webhook request is being forwarded by a third-party tool, ensure that the exact request body, including JSON formatting and new line style, is preserved.Stripe(env.STRIPE_KEY, {
httpClient: Stripe.createFetchHttpClient(), // ensure we use a Fetch client, and not Node's `http`
});const stripe = new Stripe(env.STRIPE_SECRET_KEY, {
apiVersion: '2023-10-16',
httpClient: Stripe.createFetchHttpClient()
}) const rawBody = await request.text()
const stripeSignature = request.headers.get('stripe-signature')
event = await stripe.webhooks.constructEventAsync(rawBody, stripeSignature, env.STRIPE_WEBHOOK_SECRET)⚠️ Webhook signature verification failed. Err: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? ╮
If a webhook request is being forwarded by a third-party tool, ensure that the exact request body, including JSON formatting and new line style, is preserved.
Learn more about webhook signing and explore webhook integration examples for various frameworks at https://github.com/stripe/stripe-node#webhook-signingconst stripe = getStripe({ env })
const body = await request.text()
const sig = request.headers.get('stripe-signature')
const webCrypto = Stripe.createSubtleCryptoProvider()
const event = await stripe.webhooks.constructEventAsync(
body
sig,
env.STRIPE_ENDPOINT_SECRET,
undefined,
webCrypto
)