OCI API Gateway Timeout guide with Node.js Lambda Functions
After trying multiple solutions online, I still can't figure this out. I'm not sure how to approach I'm having a hard time understanding I'm working with a timeout scenario when trying to invoke my Node.js Lambda function through the OCI API Gateway... The function is supposed to process a large amount of data and it usually takes around 30 seconds to complete. However, I'm receiving a `504 Gateway Timeout` behavior after 10 seconds of waiting. I have verified that the API Gateway is correctly set up to point to my function, and I have configured the timeout settings for both the API Gateway and the Function. The API Gateway timeout is set to the maximum value of 60 seconds, and the function timeout is set to 30 seconds as well. Hereโs the relevant part of my `serverless.yml` configuration: ```yaml functions: myFunction: handler: handler.processData timeout: 30 events: - apiGateway: path: /process method: post timeout: 60 ``` I also double-checked the IAM policies to ensure that the API Gateway has the necessary permissions to invoke the function. The Lambda function logs show that it starts processing but never completes before the timeout occurs. I tried increasing the size of the request payload, but that didn't help either. Could there be any issues with the way my function is coded or with the configuration of the API Gateway? Any insights would be greatly appreciated! Hereโs a snippet from my Lambda function to illustrate how Iโm processing the data: ```javascript const processData = async (event) => { const data = JSON.parse(event.body); // Simulate data processing return new Promise((resolve) => { setTimeout(() => { resolve({ statusCode: 200, body: JSON.stringify({ message: 'Processing complete', data }) }); }, 30000); // simulates long processing }); }; exports.processData = processData; ``` Is there a way to increase the timeout for the API Gateway or optimize my function to complete within the allocated time? Thanks, I really appreciate it! I'm using Javascript 3.11 in this project. I appreciate any insights! I'm working in a Ubuntu 22.04 environment. Any advice would be much appreciated.