Next.js Discord

Discord Forum

Running serverless functions as background jobs instead of using Inngest or AWS sqs.

Unanswered
Denmark Feist posted this in #help-forum
Open in Discord
Denmark FeistOP
I'm developing a Next.js application deployed on Vercel, and I'm facing a design decision regarding handling multiple API calls concurrently. In my application, a user action triggers a batch of x number of API calls to OpenAI, each initiated through a separate API route in Next.js. These routes invoke functions that execute the API calls asynchronously, without awaiting their completion before responding to the initial HTTP request. Once the api call is completed the result is updated on Supabase. Since Vercel supports up to 30,000 concurrent functions for the pro version, I'm considering running all API calls simultaneously for each user action. Before I was using Inngest or thinking about using AWS SQS for handling the background jobs but I'm just wondering would it be cheaper and more simple to just run them on Vercel's function and update the result on Supabase?

0 Replies