I have an array, lets say with a length of 9999. Now I want to send a message to SQS with the contents of each object in the array.
Here is how I want to send the messages:
const promises = tokens.map((token) => { const params = { Body: JSON.stringify(data), }; return sqs.sendMessage({ MessageBody: JSON.stringify(params), QueueUrl: 'my-queue-url', }).promise(); }); await Promise.all(promises); Now, the problem is that I trigger this function via API Gateway, which times out after 30 seconds. How can I avoid this? Is there a better way to do this?