• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Error on update module

Scheduled Pinned Locked Moved Bug Hunt
1 Posts 1 Posters 864 Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    soul
    last edited by soul Jul 3, 2018, 9:44 PM Jul 3, 2018, 8:46 PM

    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();
            })
    
    1 Reply Last reply Reply Quote 0
    • 1 / 1
    1 / 1
    • First post
      1/1
      Last post
    Enjoying MagicMirror? Please consider a donation!
    MagicMirror created by Michael Teeuw.
    Forum managed by Sam, technical setup by Karsten.
    This forum is using NodeBB as its core | Contributors
    Contact | Privacy Policy