CodexBloom - Programming Q&A Platform

OCI API Gateway Timeout scenarios When Calling OCI Functions with Node.js

👀 Views: 45 💬 Answers: 1 📅 Created: 2025-06-09
oci api-gateway functions nodejs JavaScript

I'm sure I'm missing something obvious here, but Hey everyone, I'm running into an issue that's driving me crazy. I am experiencing a timeout scenario when trying to invoke an OCI Function through the OCI API Gateway. My setup consists of an OCI Function written in Node.js (using Node.js v14.x) that performs a simple calculation. The function works perfectly when tested directly in the OCI console, but when I call it through the API Gateway, I get a 504 Gateway Timeout behavior after 30 seconds of waiting. Here’s a snippet of my API Gateway configuration: ```json { "endpointConfiguration": "REGIONAL", "timeoutInMilliseconds": 30000, "backend": { "type": "FUNCTION", "functionId": "ocid1.fnfunc..." } } ``` I’ve ensured that the function is deployed and active. I also tried adding logs in my function to see if it ever gets invoked, and it doesn’t seem to be reaching there when called via the API Gateway. In addition to this, I have checked the function's memory and timeout settings, which are set reasonably (memory: 128 MB, timeout: 60 seconds). I also confirmed that the API Gateway has permission to call the function using the proper IAM policies. I’ve also tried increasing the timeout setting in the API Gateway to 60000 milliseconds, but I still receive the same behavior. Here’s a simple function code that I’m using: ```javascript exports.handler = async (event) => { const result = event.number * 2; // simple operation return { statusCode: 200, body: JSON.stringify({ result }), }; }; ``` I'm not sure what might be causing this scenario. Are there any specific configurations or best practices I might be missing when setting up the API Gateway to call OCI Functions? Any help would be greatly appreciated! This is part of a larger application I'm building. Thanks in advance! For context: I'm using Javascript on Linux. Am I approaching this the right way?