In one of the recent Wappler updates, there was a timeout
event handling added in the lib/modules/api.js
file.
...
req.on('timeout', () => {
...
Ever since this update, some APIs endpoints have started to fail with timeout error. The same APIs worked fine before this change.
And this is not happening for all APIs. Eg: We are using WhatsApp's Cloud API to send messages, and also to create templates. Message sending works fine, while template creation API fails every single time with timeout error, even though the request goes through to Meta and creates the template correctly.
After adding a timeout value explicitly in the API action step, it works correctly.
As per the code in module api.js, timeout config should be the default value when not set in the API action step, but its failing randomly.
Have seen the same happening if calling a SA in the same project using an absolute URL.
The change I have implemented for now is to set default value to 120 seconds in the module api.js.
let timeout = this.parseOptional(options.timeout, 'number', 120000);