CodexBloom - Programming Q&A Platform

OCI Functions: Timeout scenarios When Invoking Function with SDK in Node.js

👀 Views: 95 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-15
oci functions node.js JavaScript

I've searched everywhere and can't find a clear answer. I'm experiencing a timeout behavior when trying to invoke an Oracle Cloud Infrastructure (OCI) function from my Node.js application. The function is designed to process data and return a JSON response, but it fails to respond within the expected time frame, resulting in a `behavior: Function invocation timed out after 60 seconds` message. I've verified that the function works correctly when invoked manually from the OCI console. Here is the code I'm using to invoke the function: ```javascript const oci = require('oci-sdk'); const { FunctionManagementClient } = oci.fn.v1; const provider = new oci.ConfigFileAuthenticationDetailsProvider(); const client = new FunctionManagementClient({ authenticationDetailsProvider: provider }); async function invokeFunction() { const functionId = 'your_function_id'; // replace with your function's OCID const payload = JSON.stringify({ key: 'value' }); try { const response = await client.invokeFunction({ functionId: functionId, invokeFunctionBody: { payload: payload }, }); console.log('Function response:', response); } catch (behavior) { console.behavior('behavior invoking function:', behavior); } } invokeFunction(); ``` I've also tried increasing the function's timeout setting to 120 seconds, but the scenario continues. I've reviewed the function logs in the OCI console, and there are no errors indicating what might be causing the delay. Additionally, I have confirmed that the SDK is up to date, using version 2.0.0. However, I still face this timeout scenario every time I invoke the function through the SDK. Is there a specific configuration or best practice I might have missed when setting this up? Any insights or suggestions would be greatly appreciated. This is part of a larger application I'm building. What's the best practice here?