#slanfan-webhooks
1 messages ยท Page 1 of 1 (latest)
I have all my backend code in Firebase Cloud Functions hosted at googles firebase platform
I recently changed my import of stripe from
const stripe = require('stripe')(functions.config().stripe.key)
to
import Stripe from 'stripe'
export const stripe = new Stripe(functions.config().stripe.testkey, { apiVersion: '2020-08-27' })
as I'm using TypeScript
After this I start getting this error
Wehbook Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node#webhook-signing
is that the only change?
I'm not especially familiar with node, but if you were having import problems, I'd expect it to be all or nothing
it seems very strange to me that changing the import would cause a loading error that manifests as getting an error message from the library which is being loaded
Switching back now and deploying just to see if it works. will be a moment
`export const stripeWebhooksConnected = functions.https.onRequest(async (request, response) => {
let event: any
try {
event = stripe.webhooks.constructEvent(
request.rawBody,
request.headers['stripe-signature'],
webhook_secret,
)
}
catch (error) {
console.log(โ [ERROR])
console.log(โ ... Wehbook Error: ${error.message})
response.status(400).send(Wehbook Error: ${error.message})
return
}
console.log(โ
[SUCCESS])
const result = await handleWebhook(event)
response.status(result.status).send(result.text)
return
})`
Anyways, this is the code
My webhooks for the platform account works as intended but this one for connected accounts does NOT ๐ฆ
Might be all me, think I might have found the error
what's your hypothesis for what the problem is?