georgegebbett / recipe-buddy

Recipe Buddy is a tool that enables the easy adding of recipes to Grocy through web scraping.
GNU General Public License v3.0
172 stars 29 forks source link

Blank Product/Unit #500

Open Servinjesus1 opened 2 months ago

Servinjesus1 commented 2 months ago

Does recipe import pull "Grocy stock" from actual Stock or Products tables? I suspect it should pull from the Product table - not what's actually in stock right now. That said, mine is pulling from neither.

I'm getting reasonable log messages stating that the instance is set up.

Simple recipe appears to scrape fine:

{"level":30,"time":1725658727704,"pid":31,"hostname":"1b710d5b2dd3","recipe":{"name":"Easy Hummus (Better than Store-Bought)","url":"https://www.inspiredtaste.net/15938/easy-and-smooth-hummus-recipe/","steps":"In the bowl of a food processor, combine the tahini and lemon juice and process for 1 minute. Scrape the sides and bottom of the bowl, then process for 30 seconds more. This extra time helps “whip” or “cream” the tahini, making the hummus smooth and creamy.\nAdd the olive oil, minced garlic, cumin, and a 1/2 teaspoon of salt to the whipped tahini and lemon juice. Process for 30 seconds, scrape the sides and bottom of the bowl, and then process for another 30 seconds or until well blended.\nAdd half of the chickpeas to the food processor and process for 1 minute. Scrape the sides and bottom of the bowl, then add the remaining chickpeas and process them until thick and relatively smooth, 1 to 2 minutes.\nThe hummus will likely be too thick and still have tiny bits of chickpea. To fix this, slowly add 2 to 3 tablespoons of cold water or aquafaba with the food processor turned on until you reach the perfect consistency.\nTaste and adjust as needed. Serve hummus with a drizzle of olive oil and a sprinkle of paprika, sumac, or Za’atar.\nStore homemade hummus in an airtight container and refrigerate for up to one week. Freeze, covered with a thin layer of olive oil, for up to one month.","imageUrl":"https://www.inspiredtaste.net/wp-content/uploads/2019/07/The-Best-Homemade-Hummus-Recipe-1200.jpg","servings":6},"ingredients":[{"scrapedName":"1 (15oz) can chickpeas or 1 ½ cups (250g) cooked chickpeas"},{"scrapedName":"1/4 cup (60ml) fresh lemon juice, 1 large lemon"},{"scrapedName":"1/4 cup (60ml) well-stirred tahini, try our homemade tahini recipe"},{"scrapedName":"1 small garlic clove, minced"},{"scrapedName":"2 tablespoons (30ml) extra-virgin olive oil, plus more for serving"},{"scrapedName":"1/2 teaspoon ground cumin"},{"scrapedName":"Salt to taste"},{"scrapedName":"2 to 3 tablespoons (45ml) cold water or aquafaba"},{"scrapedName":"Dash ground paprika, sumac, or Za’atar for serving"}],"msg":"Recipe added"}

but during import nothing is shown to select for product/unit.


Grocy: lscr.io/linuxserver/grocy:latest 61522391c2212c794fc8336294d6d3227fb0d7febb3eb7b597466f6931080a44 Recipe-Buddy: ghcr.io/georgegebbett/recipe-buddy:latest 8b9455aeb39a111c972d424be6791804ce08bd011275e04f405d30a2652910ab

Compose:

---
services:
  recipe-buddy:
    image: ghcr.io/georgegebbett/recipe-buddy
    container_name: grocy-recipe-buddy
    environment:
      - GROCY_API_KEY=${GROCY_API_KEY}
      - GROCY_BASE_URL=${GROCY_BASE_URL}
      - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
      - NEXTAUTH_URL=http://localhost:3005
    ports:
      - 3005:3000
    volumes:
      - rb_data:/home/node/app/data

volumes:
  rb_data:
flamableconcrete commented 2 months ago

I'm getting this as well, although I'm running Grocy natively without Docker, as the latest version - 4.2.0. I checked the browser console logs and see over and over that the following two API calls keep getting logged

grocy.getQuantityUnits
grocy.getProducts

and for a more thorough message it looks like this.

TRPCClientError: [ { "code": "invalid_type", "expected": "array", "received": "object", "path": [], "message": "Expected array, received object" } ]

Hopefully that helps track this down!

flamableconcrete commented 2 months ago

oh, another clue that i don't know how i missed is that on the settings page it tells me right there, "Not connected to Grocy Unable to connect to Grocy - check your URL and API key"

So what do you know - once I double checked my Recipe Buddy's Docker compose file, I had my GROCY_BASE_URL set incorrectly. I had the trailing /api/. Once I removed that, the rest of everything worked just fine!

Servinjesus1 commented 2 months ago

I am seeing the same error now, I wasn't dwelling on the settings page sufficiently long for the Not connected to Grocy error to pop up. But I can't fix it and I think I have my command (or in this case docker-compose file) configured correctly. Can someone who uses the Grocy docker chime in?

To be specific:

Have I done something wrong here?

I'm not capable enough to try hosting Grocy natively without docker. Particularly on how to spin up the repo to host it on a local port.

The database is working fine, so at least I know the plugin itself is presumably operating normally.

Lake-e commented 1 month ago

@Servinjesus1 What worked for me is using the IP of the machine that is hosting it, rather than "localhost". I think in this case, localhost refers to the docker instance, rather than the machine itself.