Food Search Not Working

When I search for a certain food and hit the button that says Add Food to Diary, it takes me to a page that says: Page Not Found. I've cleared my cache, but it still is not working. Any suggestions?

Best Answers

  • durden
    durden Posts: 3,592 MFP Staff
    Answer ✓
    Please reach out to our dedicated support team for assistance by visiting https://myfitnesspal.zendesk.com/hc/en-us or emailing directly to support@myfitnesspal.com
  • metal_hurlant
    metal_hurlant Posts: 3 Member
    Answer ✓
    Found a workaround. Instead of using the "Add Food" links in the diary that take you to /food/search and will ultimately fail, click on the "Database" link in the top sub-menu under the "Food" menu, then search and add your foods there.
    This will hit an endpoint that works and you'll be able to add foods to your diary that way.

Answers

  • VanWertWest
    VanWertWest Posts: 1 Member
    I have been having the same problem, since 4/26/24.
  • matthewneiger2
    matthewneiger2 Posts: 1 Member
    Same.
  • metal_hurlant
    metal_hurlant Posts: 3 Member
    Same.
    The "add food to diary" buttons submits a POST to /food/add, which redirects to /accounts/login?callback=.../food/add, which loads a GET to /food/add with all the form data missing, which shows an outdated "page not food" error.
    So probably a bad authentication check in the /food/add handler or something.
  • metal_hurlant
    metal_hurlant Posts: 3 Member
    Alright, last post to this thread I swear.
    If you understand what a userscript is and you're comfortable using them, here's one that will take you to the database search page when you focus the search bar on an "add food" pages, keeping you away from the broken bits.
    It's a tradeoff, as you'll need to adjust the day and meal yourself on every add, but it's what I'm using until this gets fixed.
    // ==UserScript==
    // @name         MFP add food bug workaround
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  route around damaged /food/add API
    // @author       metal_hurlant
    // @match        https://www.myfitnesspal.com/food/*
    // @match        https://www.myfitnesspal.com/user/*/diary/add
    // @icon         https://www.google.com/s2/favicons?sz=64&domain=myfitnesspal.com
    // @run-at       document-start
    // ==/UserScript==
    addEventListener('load', _=>({
      add_to_diary() { document.querySelector('#search').addEventListener('focus', _=> location.assign('/food/calorie-chart-nutrition-facts')) },
      add() { this.add_to_diary() },
      'calorie-chart-nutrition-facts': _=> document.querySelector('[name="searchInput"]').focus()
    })[location.pathname.split('/').at(-1)]?.());
    

  • HealtheSS
    HealtheSS Posts: 6 Member
    edited May 1
    Just tried it this morning & it's working now! Thanks for all your replies! :)
  • Ll0ydD0bler
    Ll0ydD0bler Posts: 17 Member
    The problem went away for me for a single food item but otherwise I'm still having it. I can add food on the phone app so that's my workaround but I hate it.
  • lmiles2005
    lmiles2005 Posts: 2 Member
    I'm having the very same issue, so I copied and pasted from a previous post: When I search for a certain food and hit the button that says Add Food to Diary, it takes me to a page that says: Page Not Found. I've cleared my cache, but it still is not working.
  • epuni
    epuni Posts: 10 Member
    This has been going on for a few weeks now. It only happens when using firefox but explorer works fine. I'm a firefox user so I'm hoping this gets fixed soon.
  • LanneCheese
    LanneCheese Posts: 3 Member
    I realize this is an old post but I just signed up yesterday and I'm having this same issue using Chrome browser on my desktop. Has anything changed since May regarding this issue? I will try it on MS Edge to see if it works there.
  • WCSkid
    WCSkid Posts: 1 Member
    Same problem here.