Hi everyone,

I’m doing a module (display data from Habitica ) .

I got the following errors but not at every update. I happened like about 1 time every 5 min (i haven’t seen any regular pattern, it can happen several time in 1 minute and nothing for 10 minutes). And the error can be one of the 3 following :

Error: read ECONNRESET (or Error: read ETIMEDOUT) at TLSWrap.onread UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘hash’ of null Error: getaddrinfo ENOTFOUND habitica.com

This is what i have coded :

MMM-Habitica.js : updateHabitica => sendSocketNotification(myConfig) node_helper.js : reload() => forEach (members in config.members) => send https request ; on requestResult.end => sendSocketNotification(returnData) MMM-Habitica.js : socketNotificationReceived => gather data and construct dom object

Does anybody has a clue about what could go wrong? (https request with forEach, wrong data from api, other? )

Any help would be greatly welcome

Guillaume

**UPDATE : ** :man_dancing_light_skin_tone:
It seems enclosing the https request in a promise resolve the issue no error so far

return new Promise((resolve, reject) => { var req = https.request(requestOptions, (res) => { res.setEncoding('utf8'); res.on('data', (chunk) => { try{ JSONParsed = JSON.parse(chunk); }catch(error) { } }); res.on('end', () => { self.sendSocketNotification(reloadType, JSONParsed); }); req.on('error', (e) => { console.log(`problem with request: ${e.message}`); }); }); req.end(); })