Read the statement by Michael Teeuw here.
Error on update module
-
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 farreturn 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(); })
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login