Extensions timeout

Dan Morphis dan at milkcarton.com
Thu Jan 31 14:54:16 EST 2019


You can increase the extension timeout by adding "EXT_TIMEOUT": 30000, to
the genieacs/config/config.json file. Timeout is in milliseconds.

-dan

On Tue, Jan 29, 2019 at 11:27 PM Mirek Lauš <mirek at laus.cz> wrote:

> Hello Genieacs users,
>
> my extensions sometimes results in timeout without a reason giving a NodeJS
> error in the log:
>
> >  1: node::Abort(void) [/usr/local/bin/node]
> >  2: node::PlatformInit(void) [/usr/local/bin/node]
> >  3: node::Start(int, char**) [/usr/local/bin/node]
> >  4: _start [/usr/local/bin/node]
>
> My extension is called from Provision script:
>
> > let genieacsId = declare("DeviceID.ID", {value: 1}).value[0];
> > let externalIp =
> declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress",
> {value: 1}).value[0];
> > let connReqUrl =
> declare("InternetGatewayDevice.ManagementServer.ConnectionRequestURL",
> {value: 1}).value[0];
> >
> > let args = {id: genieacsId, url: connReqUrl, ip: externalIp};
> >
> > log('remoteCallback call script');
> >
> > let resp = ext('remote', 'remoteCallback', JSON.stringify(args));
> > log('remote response ' + genieacsId + ': ' + resp);
>
> And the extension:
>
> > const API_URL = 'https://remote.url/api/genieacs';
> > const url = require("url");
> > const http = require(API_URL.split(":", 1)[0]);
> >
> > const logger = require('../../lib/logger');
> >
> > function remoteCallback(args, callback) {
> >
> >   let params = JSON.parse(args[0]);
> >
> >   const uri = API_URL + "/callback.pl?id=" + params.id + "&url=" +
> params.url + "&ip=" + params.ip;
> >
> >   let options = url.parse(uri);
> >   options.headers = { accept: 'application/json', "content-type":
> 'application/json' };
> >
> >   logger.info({message: 'post callback ' + params.id});
> >
> >   let request = http.get(options, function (response) {
> >
> >     if (response.statusCode == 404) {
> >       return callback(null, null);
> >     }
> >
> >     if (response.statusCode >= 400) {
> >       return callback(new Error("Unexpected error. Response Code: " +
> >       response.statusCode + '. Status Message: ' +
> response.statusMessage + '. t: ' + typeof response.statusCode));
> >     }
> >
> >     let data = "";
> >
> >     response.on("data", function(d) {
> >       data = data + d.toString();
> >     });
> >
> >     response.on("end", function () {
> >       logger.info({message: 'post callback response: ' + data});
> >       return callback(null,data);
> >     });
> >
> >   });
> >
> >   request.on("error", function (err) {
> >     logger.info({message: 'post callback error: ' + err});
> >     callback(err);
> >   });
> >
> > }
> >
> > exports.remoteCallback = remoteCallback;
>
>
> How to debug this?
>
> Regards
> Mirek
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20190131/d6ade0bb/attachment.html>


More information about the Users mailing list