Error in genieacs-cwmp 1.2.2

Hello everyone.
I’m trying create script for autoprovision but got cwmp error in log-file:

2020-10-14T07:41:19.598Z [ERROR] Uncaught exception; pid=18628 exceptionName="TypeError" exceptionMessage="Cannot read property 'faultCode' of undefined" exceptionStack="TypeError: Cannot read property 'faultCode' of undefined\n    at Z (/usr/local/lib/node_modules/genieacs/bin/genieacs-cwmp:2:8994)\n    at Q (/usr/local/lib/node_modules/genieacs/bin/genieacs-cwmp:2:9673)\n    at ae (/usr/local/lib/node_modules/genieacs/bin/genieacs-cwmp:2:10538)\n    at ie (/usr/local/lib/node_modules/genieacs/bin/genieacs-cwmp:2:10618)\n    at Tn (/usr/local/lib/node_modules/genieacs/bin/genieacs-cwmp:2:121297)\n    at /usr/local/lib/node_modules/genieacs/bin/genieacs-cwmp:2:126488\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)"
2020-10-14T07:41:19.680Z [ERROR] Worker died; pid=18628 exitCode=0
2020-10-14T07:41:20.319Z [INFO] Worker listening; pid=18672 address="0.0.0.0" port=7547

provision-script below. It’s not best. set and unset tags also don’t work. Is the reason of error in the script?
Thank u in advance

//Initial setup
const time = Date.now();
let mac = declare(“DeviceID.SerialNumber”,{value:1}).value[0];
let wkey = declare(“DeviceID.SerialNumber”,{value:1}).value[0];
let ssid = “Tele” + mac.substring(7);
let bam = “EAPAuthentication”;
log("SSID: "+ssid);
log("WLAN KEY: "+wkey);
declare(“Tag.Configuring”, {value:time}, {value:true});
declare(“InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode”,{value:time},{value:bam});
declare(“InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID”,{value:time},{value:ssid});
declare(“InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.KeyPassphrase”,{value:time},{value:wkey});
declare(“InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.RadioEnabled”,{value:time},{value:true});
declare(“Tag.NEW”, {value:time}, {value:false});

I don’t see anything inherently wrong with your script, but the second parameter on declare(“Tags.foo”) is only used when getting, not setting the value. Not sure if that will make a difference (in theory it shouldn’t).

I’ve cleaned up your script, try this and see if it works:

const time = Date.now();
let mac = declare("DeviceID.SerialNumber", { value: 1 }).value[0];
let wkey = declare("DeviceID.SerialNumber", { value: 1 }).value[0];
let ssid = "Tele" + mac.substring(7);
let bam = "EAPAuthentication";
log("SSID: " + ssid);
log("WLAN KEY: " + wkey);
declare("Tag.Configuring", null, {value: true});
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode", { value: time }, { value: bam });
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID", { value: time }, { value: ssid });
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.KeyPassphrase", { value: time }, { value: wkey });
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.RadioEnabled", { value: time }, { value: true });
declare("Tag.NEW", null, { value: false });

The exception is getting thrown because the CPE is sending an incomplete fault message. It’s missing the ‘detail’ XML element. Will have to add a guard to handle this gracefully. By gracefully I mean to reject the request and display an error message without crashing the process.

Now I feel dumb for not reading the error messages and presuming I knew where the issue was :smiley:.

Thank u Zaid. FYI I got that cause with 2 misstypes (my hands…)) in script and one unknown point.

As for initial script, it was misstypes Tag.NEW -> Tags.NEW

but script was wrong :slight_smile: as u wrote: declare(“Tags.foo”). its right syntaxis and misstypes was in first parameter))