Next.js Discord

Discord Forum

Serverless function not completeing

Unanswered
Elegant Tern posted this in #help-forum
Open in Discord
Elegant TernOP
I have a serverless function that I have wrote that is copying a few files and folders using the google drive api. I then save the id of one of the folders in my db. In my local environment it works fine. But when deployed to vercel my logs just seem to stop randomly in the function (I have pretty detailed logging and the last log that shows up seems to change each time). I don't beleive my function is timing out. I'm a little confused how to debug this, or perhaps this is just not something that should be deployed using a serverless function?

19 Replies

what error you get?
and where is the db hosting?
Elegant TernOP
I dont get an error. That's why I am having trouble figuring it out. It will log something from one of my console logs like:
 
`Added folder to queue: fileName. Queue length: 1`

But that isnt the place it consistently stops at. My last log from it might be a different one. I'm using Neon for my db.
so the function is copying files and folder from google drive then process it and store the data to db?
Elegant TernOP
I have a template folder with a couple nested folders and files. It copies those folders into a new shared drive folder and then stores the id of 2 of the folders it creates in the db so that I can use those ids later to fetch the folders.
how big are those files?
Elegant TernOP
Usually all or most of the folders get properly copied. And my first folder id might get saved but not the 2nd one.
they're small and its the google drive api that actually does the copying - i just do a post to it and return the ids.
biggest file is 11kb
no log for the function at all?
Elegant TernOP
I get pretty comprehensive logging. But the thing is the top log that I have from the create-folder shows
 Processiong folder: .... 

There should be more logging and completing after that but it just stops logging anything from that request route.
click one of the function and see the status of the function on the right
does the status of duration and memory look good?
Elegant TernOP
Yes. All those are just info level logs. They dont show the execution duration/limit or memory uses / limit.
None of the logs that are running on other routes are showing any issues with limits.
Elegant TernOP
I'll give that a try.
Thanks.
Elegant TernOP
I have it working now. Thanks for you help. Turns out I forgot an
await
🤦‍♂️
haha