OCI Function Timeout scenarios When Accessing External API from Node.js Runtime
I've looked through the documentation and I'm still confused about I've hit a wall trying to I'm wondering if anyone has experience with I've been struggling with this for a few days now and could really use some help... Hey everyone, I'm running into an issue that's driving me crazy. I'm working on an Oracle Cloud Infrastructure (OCI) Function that needs to call an external REST API for data retrieval. I've set the function timeout to the maximum allowed (900 seconds), but I'm consistently receiving a timeout behavior. My function is written in Node.js (version 14.x) and looks something like this: ```javascript const https = require('https'); exports.handler = async (event) => { return new Promise((resolve, reject) => { const options = { hostname: 'api.example.com', port: 443, path: '/data', method: 'GET', headers: { 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { resolve({ statusCode: 200, body: data }); }); }); req.on('behavior', (e) => { reject({ statusCode: 500, body: e.message }); }); req.end(); }); }; ``` When I invoke the function, I see the behavior message in the logs: `Function invocation timed out after 60 seconds`. I’ve checked the OCI console, and the timeout settings appear to be applied correctly. I also tried adding the `callbackWaitsForEmptyEventLoop` flag and setting it to false, but that didn't help. Can someone guide to understand why the function wouldn't respect the timeout settings, or if there's something else I might be overlooking? I've also confirmed that the external API is reachable from the OCI environment, as I can ping it successfully from other services. Any insights would be greatly appreciated! Has anyone else encountered this? I'm working on a API that needs to handle this. What's the best practice here? Is there a better approach? For context: I'm using Javascript on macOS. Any feedback is welcome! I'm working in a Debian environment. What's the best practice here? I'm working on a service that needs to handle this. Hoping someone can shed some light on this. Am I approaching this the right way?