S
Supabase2y ago
Kal

Long-running (1+ min) Vercel Serverless function called from Supabase trigger/function

My project is attempting to trigger a function when a user first saves some content to a Supabase table. There is a function and trigger set up to do this currently. The issue I'm running into is that the length of the serverless function causes a timeout on the database operation if it waits for a response, but Vercel terminates serverless functions once they return a response. Not sure how to get around this dilema. My guess is that I could stream the response back, but feel that that would cause the same blocking issue.. Essentially I want to kick off this serverless function and not wait for a response. Any help is greatly appreciated!
5 Replies
garyaustin
garyaustin2y ago
You could call with pg_net as it is async.
Kal
KalOP2y ago
thanks for the response! i've switched over to this and it seems to be working from the Supabase side of things - no longer blocking and can see a call to the serverless function. this is probably outside the parameters of the ask, but in the Vercel logs it's showing a GET request to the endpoint and a 308 Resume Incomplete with no other logs. does this endpoing need registered or are there other common configuration issues to look out for?
garyaustin
garyaustin2y ago
Just to not have you waiting on me, I have no idea about Vercel.
Kal
KalOP2y ago
no worries, thanks again for pointing me in the right direction
Kal
KalOP2y ago
so for anyone reading this in the future getting a 308 Resume Incomplete response from Vercel, make sure your domain is prefixed with www. for more info: https://stackoverflow.com/a/75175036
Stack Overflow
Stripe webhook returning 308 error when calling Vercel serverless f...
I've set up a webhook with Stripe, which calls a serverless function when it's triggered. The function is intended to update an entry in my database when it's called, suggesting that a user has sig...

Did you find this page helpful?