#SkyWar-webhooks

1 messages ยท Page 1 of 1 (latest)

lament field
#

๐Ÿ‘‹ happy to help

#

the error you're getting is because the request timed-out

modern star
#

Hello! Thanks!

#

So increasing the timeout might help?

#

Cause there are no errors on the cloud function side

lament field
#

no actually the recommended way of solving this is to do use the webhook endpoint just to fire async jobs

#

and return as fast as you can a response to the webhook request

modern star
#

Most of the jobs are async though

#

or do you mean not to use async tasks?

lament field
#

I mean basically you get the request which it's only job is to fire another Task in a fire and forget mode

#

and that should handle the actions you're trying to do

#

the endpoint itself should not be used for heavy work

modern star
#

ohh okay cause currently the endpoint is responsible for reading database, updating database, generating invoice and data conversion

#

so yea, alot of heavy work

lament field
#

which means that it will probably take a lot of time and eventually we will fail the request since we didn't get any response within the window of our time-out

modern star
#

So basically instead of awaiting here, I directly pass okay as the status?

exports.sessionWebhook = functions.region("asia-south1").runWith({
  timeoutSeconds: 90,
  memory: "2GB",  
}).https.onRequest(async (req, res) => {
   await stripeHandler.sessionWebhook(req, res, db);
});

#
//Like
stripe.callFunction()
res.status(200).send()
modern star
modern star
lament field
#

yes something like that

#

where you don't await for the callFunction to end

#

this should only be firing another Task/Job

modern star
#

okay will try that out! Thanks!