• 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.

MMM-MealieMenu Fetch Error

Scheduled Pinned Locked Moved Solved Troubleshooting
30 Posts 3 Posters 4.8k Views 3 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.
  • W Offline
    WallysWellies @sdetweil
    last edited by May 24, 2024, 9:13 PM

    @sdetweil Thank you for your advice and apologies for the delayed response - I need to enable email notifications or something…

    I will try your suggestion. Much appreciated.

    1 Reply Last reply Reply Quote 0
    • W Offline
      WallysWellies @sdetweil
      last edited by May 24, 2024, 9:31 PM

      @sdetweil I’m looking at the node_helper.js file and reading your comments and I’m a little unsure what you are suggesting.

      Are you saying I could edit this code block:

      .catch((error) => {
              this.sendSocketNotification("MEALIE_ERROR", {
                error: "FETCH_ERROR",
                details: error,
                identifier: config.identifier
              });
            })
      

      to this:

      .catch((error) => {
              this.outstandingRequest = false; 
              this.sendSocketNotification("MEALIE_ERROR", {
                error: "FETCH_ERROR",
                details: error,
                identifier: config.identifier
              });
            })
      

      ?

      Sorry, I can fumble my way around code but I’m far from a programmer!

      S 1 Reply Last reply May 24, 2024, 10:32 PM Reply Quote 0
      • S Offline
        sdetweil @WallysWellies
        last edited by May 24, 2024, 10:32 PM

        @WallysWellies yes, correct

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        W 1 Reply Last reply May 24, 2024, 10:45 PM Reply Quote 0
        • W Offline
          WallysWellies @sdetweil
          last edited by May 24, 2024, 10:45 PM

          @sdetweil Done!

          I shall try and remember to report back if it seems to have worked - if I do not then we can assume I am a happy customer.

          Cheers for your time.

          S 1 Reply Last reply May 24, 2024, 11:05 PM Reply Quote 0
          • W WallysWellies has marked this topic as solved on May 24, 2024, 10:46 PM
          • S Offline
            sdetweil @WallysWellies
            last edited by May 24, 2024, 11:05 PM

            @WallysWellies remember that this is not an official change, so it could be lost.if you refresh the module

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • Z Offline
              zanix
              last edited by May 26, 2024, 5:42 AM

              @sdetweil said in MMM-MealieMenu Fetch Error:

              @WallysWellies I am a mealie user too.

              code looks good. will have to setup and test.

              it does get the data frequently
              60 seconds by default…

              I should probably set the default to something higher. I had it set to 60 seconds while I was developing it.

              @sdetweil said in MMM-MealieMenu Fetch Error:

              @WallysWellies ok… I’ll watch it running here at 15 min updates…

              well, I found it…

              in the node helper he sets a flag, to say request is active

              if the flag is set when the request comes from the module side
              he just returns… does nothing.

              on error he does not clear the flag
              (bad network, host, authorization… places where there is no recovery
              those make sense…)

                    .catch((error) => {   //<--- had and error here ... 
                      this.sendSocketNotification("MEALIE_ERROR", {
                        error: "FETCH_ERROR",
                        details: error,
                        identifier: config.identifier
                      });
                    })
                    .finally(() => {
                      this.outstandingRequest = false;   // < --- only clears flag on success
                    });
              

              one could examine the error and reset if its a potentially recoverable error…

              I thought finally() runs even after a catch(), dangit.

              @WallysWellies said in MMM-MealieMenu Fetch Error:

              @sdetweil I’m looking at the node_helper.js file and reading your comments and I’m a little unsure what you are suggesting.

              Are you saying I could edit this code block:

              .catch((error) => {
                      this.sendSocketNotification("MEALIE_ERROR", {
                        error: "FETCH_ERROR",
                        details: error,
                        identifier: config.identifier
                      });
                    })
              

              to this:

              .catch((error) => {
                      this.outstandingRequest = false; 
                      this.sendSocketNotification("MEALIE_ERROR", {
                        error: "FETCH_ERROR",
                        details: error,
                        identifier: config.identifier
                      });
                    })
              

              ?

              Sorry, I can fumble my way around code but I’m far from a programmer!

              I will get this fix added and set the default updateInterval to something a bit more sane soon. Thanks to all for troubleshooting!

              W 1 Reply Last reply May 26, 2024, 7:37 AM Reply Quote 0
              • W Offline
                WallysWellies @zanix
                last edited by May 26, 2024, 7:37 AM

                @zanix Thanks for your input :)

                I made the change after posting and it certainly doesn’t break anything but I have been playing with some other modules too so have restarted the software several times meaning I haven’t given it a chance to error but based on my understanding it probably shouldn’t anymore. I don’t know why it was in the first place though - the Mealie container is on the Pi so it’s using localhost to retrieve data. Who knows.

                I did make one other change because I wanted to see the next week of meals, rather than the remaining meals this week. So I changed this line:

                const startOfWeek = this.getFirstDayOfWeek(config.weekStartsOnMonday);
                

                to this:

                const startOfWeek = moment();
                

                It’s pretty crude but if you’re taking suggestions it might be nice to have the option to show x number of days in the future rather than until the end of the week. I don’t believe that’s currently possible natively?

                Thanks for the module though, it’s great!

                Z 1 Reply Last reply May 27, 2024, 4:54 AM Reply Quote 0
                • Z Offline
                  zanix @WallysWellies
                  last edited by zanix May 27, 2024, 4:56 AM May 27, 2024, 4:54 AM

                  @WallysWellies said in MMM-MealieMenu Fetch Error:

                  @zanix Thanks for your input :)

                  I made the change after posting and it certainly doesn’t break anything but I have been playing with some other modules too so have restarted the software several times meaning I haven’t given it a chance to error but based on my understanding it probably shouldn’t anymore. I don’t know why it was in the first place though - the Mealie container is on the Pi so it’s using localhost to retrieve data. Who knows.

                  Hopefully that fixes the issue, let me know otherwise.

                  I did make one other change because I wanted to see the next week of meals, rather than the remaining meals this week. So I changed this line:

                  const startOfWeek = this.getFirstDayOfWeek(config.weekStartsOnMonday);
                  

                  to this:

                  const startOfWeek = moment();
                  

                  It’s pretty crude but if you’re taking suggestions it might be nice to have the option to show x number of days in the future rather than until the end of the week. I don’t believe that’s currently possible natively?

                  Before now no, but I did just add the fetch fix, updateInterval default to 1 hour, and some additional meal entry options in version 1.5.0.

                  The options are:

                  • currentWeek: Only show meals for the current week.
                  • dayLimit: How many days will be displayed after today.
                  • entryLimit: How many entries from future days should be shown in total.

                  Now you can just set currentWeek to false to get the same effect.

                  Thanks for the module though, it’s great!

                  I appreciate that, glad it’s useful!

                  1 Reply Last reply Reply Quote 0
                  • W Offline
                    WallysWellies
                    last edited by Jun 1, 2024, 1:35 PM

                    @zanix The mealie module has been in an error since yesterday and I wonder if you might be able to help me troubleshoot?

                    I have run the following command:

                    tail -100 .pm2/logs/mm-error.log
                    

                    And at the end I see the following:

                    [2024-05-31 16:47:51.577] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-05-31 17:47:51.580] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-05-31 18:47:51.581] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-05-31 19:47:51.590] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-05-31 20:47:51.571] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-05-31 21:47:51.575] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-05-31 22:47:51.582] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-05-31 23:47:51.574] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 00:47:51.604] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 01:47:51.601] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 02:47:51.576] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 03:47:51.576] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 04:47:51.577] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 05:47:51.575] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 06:47:51.580] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 07:47:51.571] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 08:47:51.577] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 09:47:51.572] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 10:47:51.577] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 11:47:51.576] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 12:47:51.568] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    [2024-06-01 13:47:51.580] [ERROR] [MMM-MealieMenu] Fetch error: "Unauthorized"
                    

                    I have confirmed that the correct username / password is in my config.js file (and it has worked previously) - I can login via my laptop using http://raspberrypi:9925/ using these credentials.

                    The config.js file is using the following line for the connection:

                    host: "http://localhost:9925"
                    

                    I use browser / terminal / SSH etc. to access the Pi but if necessary I can connect a keyboard / mouse if that would aid in narrowing down the issue.

                    Do you have any thoughts? I can probably just restart the mirror service but I haven’t yet in case that deletes any valuable information. Any advice would be appreciated.

                    1 Reply Last reply Reply Quote 0
                    • W Offline
                      WallysWellies
                      last edited by Jun 1, 2024, 2:21 PM

                      • I have found the part of Mealie that allows creation of an API key so I could switch to that method for authentication.
                      • I also see I am a couple of versions behind the Mealie master branch (I use version 1.5.1 - current version is 1.7.0). That looks drastic but it’s only 2 releases behind.

                      I don’t think either of these things are causing my issue necessarily but it’s a couple of things I can change soon.

                      S 1 Reply Last reply Jun 1, 2024, 2:45 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 1 / 3
                      1 / 3
                      • First post
                        10/30
                        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