How to set a time limit on the HttpClient.send in JavaScript in Apigee Edge
I don’t want to add timelimit in JS policy.
I have to set timelimit in JS only. Below code is not working.
var authRequest = new Request(context.getVariable(‘url’), “POST”, header, formBody(payload));
var response = httpClient.send(authRequest, response => {
fetchAuth(response);
}, 1000); //timeout in 1 sec
As setTimeout, Promise, callback, http, setInterval are not working. How can i set timeout limit in API call? Please help.
Can we use ServiceCallout Policy if yes then how, because we don’t have to call target end point directly, as needs to call OAuth from JS where i have to set timeout.
Hi @Garima96 , thanks for your question, we’ve noticed it hasn’t received an answer yet. We encourage other community members to take a look and share any insights they may have. We’ll also keep an eye on the conversation to ensure you get a response
In the meantime, feel free to check out our upcoming events and articles - you might find related resources helpful.
I’m also experiencing this issue, which is significantly impacting our ability to support customers using Apigee in conjunction with our software. This limitation has surfaced multiple times in community discussions over the years, but it’s unclear if or when native timeout support for httpClient.send() in JavaScript might be implemented.
Is there any update on whether native support for this feature is planned or under consideration? This would be immensely helpful for those of us needing direct control over request timeouts within JavaScript policies.