The Serverless Function Execution Timeout
limit (NextJS Limits) is 10 seconds for the HOBBY plan. You may need to upgrade to PRO to get 60 seconds. Beware, you may also need to deal with API Gateway, which has a 30 second timeout.
What you probably want to do is have the API push the request data into an SQS queus, and return the message-id of queue item. This will happen in milliseconds. The SQS queue can trigger a lambda. The lambda will process the job and then update DynamoDB. You could use long polling to check for the DynamoDB update or perhaps a GraphQL subscription to be notified.
You may be able to skip the SQS queue and just write the new job into DynamoDB. Then use DDB streams to trigger the lambda that will process the job. Just be careful not to create an infinite loop when the lambda updates the DDB record to mark the job as completed (fail or success).
It seems there are also some SAAS services (Defer) that can help this situation.