#slanfan-webhooks

1 messages ยท Page 1 of 1 (latest)

bold rose
#

hey, what's up?

royal ember
#

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

bold rose
#

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

royal ember
#

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

bold rose
#

what's your hypothesis for what the problem is?