Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to Grocy #492

Open
Bush-cat opened this issue May 27, 2024 · 10 comments
Open

Unable to connect to Grocy #492

Bush-cat opened this issue May 27, 2024 · 10 comments

Comments

@Bush-cat
Copy link

I wanted to try out the Application, wanted to add a Recipe but I couldn't choose any Products, in the Settings I saw the message "Not connected to Grocy, Unable to connect to Grocy - check your URL and API key"
In Grocy at the API Keys, it says Last used is Never for my recipe-buddy api key
I can ping my Server from the container and added other Applications like Grocy Android with a differrent API Key before.
I tried a new API key and tried my nginx proxy manager domain and ip+port.

Here is my docker compose which I run in Portainer

services:
    recipe-buddy:
        ports:
            - 3005:3000
        volumes:
            - /volume1/smarthome/configs/recipe-buddy/config:/home/node/app/data
        environment:
            - GROCY_API_KEY=REDACTED
            # - GROCY_BASE_URL="https://grocy.REDACTED"
            - GROCY_BASE_URL="http://192.168.111.100:9192"
            - NEXTAUTH_SECRET=REDACTED
            - NEXTAUTH_URL=https://recipe.REDACTED
        image: ghcr.io/georgegebbett/recipe-buddy
@georgegebbett
Copy link
Owner

That's odd - are you saying that you are able to ping the Grocy server from within the Recipe Buddy container? If so I can't think of a reason you wouldn't be able to connect from one to the other... What version of Grocy are you running?

@Bush-cat
Copy link
Author

Bush-cat commented Jun 6, 2024

Correct, with the sh shell in the recive buddy container, I can ping the grocy IP and port.

I installed grocy as a homeassistant addon a week ago, apparrently it's running Version 4.0.3, there seems to be a newer Version available 4.2.0.
I will try setting grocy up again outside homeassistant

@Bush-cat
Copy link
Author

Bush-cat commented Jun 6, 2024

I tried again, completely new containers, latest recipe-buddy and latest grocy 4.2.0, I tried many methods to connect the containers, network mode, host mode, all that stuff but still no success.

It would be great to have more details on on where it fails in the logs

@lionelripoll
Copy link

I think I have the same issue.
I can't connect to the server:
image

Grocy is running in home assistant. I can ping home assistant in the contener
ping homeassistant.local
or
ping homeassistant.local:8123

this is the command I used:
docker run \ -p 3005:3000 \ -v rb_data:/home/node/app/data \ --env GROCY_API_KEY=AgplxUgwoqxnLPqDUXdotDOLcvCNg7nQZ1Zv5kEp6x1CAL0u** \ --env GROCY_BASE_URL=http://homeassistant.local:8123 \ --env NEXTAUTH_SECRET=7LO8hR4dl3+V8L7UawOkfv19qMA6MEzl5O9XIHAHN3** \ --env NEXTAUTH_URL=http://localhost:3005 \ ghcr.io/georgegebbett/recipe-buddy

I also tried to add the subdirectory:
docker run \ -p 3005:3000 \ -v rb_data:/home/node/app/data \ --env GROCY_API_KEY=AgplxUgwoqxnLPqDUXdotDOLcvCNg7nQZ1Zv5kEp6x1CAL0u** \ --env GROCY_BASE_URL=http://homeassistant.local:8123/a0d7b954_grocy/ \ --env NEXTAUTH_SECRET=7LO8hR4dl3+V8L7UawOkfv19qMA6MEzl5O9XIHAHN3** \ --env NEXTAUTH_URL=http://localhost:3005 \ ghcr.io/georgegebbett/recipe-buddy

@Bush-cat
Copy link
Author

Bush-cat commented Jun 8, 2024

@lionelripoll port 8123 only runs the homeassistant webui, it has nothing to do with grocy, there was an option to open a port or network for the grocy addon configuration, use that and then you can use the grocy api with the port you set there.

@Bush-cat
Copy link
Author

I was hoping to be able to use grocy with this project but making items manually in grocy is too annoying for me so I will have to uninstall grocy, I'm willing to try it again sometime if the Software works

@valerian-guichard
Copy link

valerian-guichard commented Aug 19, 2024

Hi ! i have the same problem : here is my docker compose file :

image

I get the same "Not connected to grocy" message and can't find out why nor how to solve it, (of course i've put my api key in the code, i juste changed it for the screenshot)

I would really appreciate help :))

@sidial01
Copy link

sidial01 commented Oct 5, 2024

I was having a similar issue, except I wasn't even getting an error on the settings page. I had get into the docker console to ping items. However, what I found MOST useful in troubleshooting was getting into Grocy's API browser, and using the API key assigned for Recipe Buddy. That allowed me to determine that the API was not being accessed by Recipe Buddy at all.

Since I have Grocy running in a Grocy-specific network configuration in Docker (to let it work properly with BarcodeBuddy), RecipeBuddy needs to

  1. be on the same network in Docker,
  2. reference the INTERNAL IP AND PORT. For me, that was 172.20.0.x:80. (It is NOT the 9283 default published port for Grocy-Docker.) I also changed the "nextauth_url" to the RecipeBuddy container's manually-configured internal docker IP vs the host IP.

The cURL command won't work directly in the Docker command line without some adjustments, but this is the cURL that finally worked:

curl -X 'GET'
'http://grocy_internal_container_ip:80/api/system/info'
-H 'accept: application/json'
-H 'GROCY-API-KEY: $api_key'

So for "GROCY_BASE_URL", the correct setting was "grocy_internal_container_ip:80", rather than "docker_host_ip:9283".

Steps for resolution:

  1. Connect to Docker console for Recipe Buddy container (using SH).
  2. Install cURL. Alpine command: apk --no-cache add curl (https://www.shellhacks.com/alpine-install-curl/)
  3. Attempt the Grocy API commands generated from the internal REST browser. Time outs occurred with no response.
  4. Pings to the IP (same host) were just fine.
  5. Install telnet (https://devcoops.com/install-telnet-on-alpine-linux/ ).
  6. telnet host_ip 9283 -- failed, time out.
  7. telnet grocy_docker_ip 9283 -- failed, connection refused.
  8. Attempted the cURL command again, changing to grocy_docker_ip:80 in the REST API browser generated code. Response!
  9. Made those changes to the ENV from Portainer's interface, and redeployed the container. Success!

@Kimbaras
Copy link

I'm having a similar issue using Grocy 4.2.0 and latest RecipeBuddy image.

I'm getting the "Not connected" error in the setting tab
Immagine 2024-10-24 123050

I've quickly tried @sidial01 solution / workaround but I wasn't able to get it to work, will try a little bit more focused later.

@Stretsh
Copy link

Stretsh commented Nov 26, 2024

Installed Grocy using the default instructions (but with Portainer), and it was added in a separate network in Docker. Same goes for RB. So I think it is important that the owner adds this for clarity in the doc/readme.

  1. be on the same network in Docker,
  2. reference the INTERNAL IP AND PORT. For me, that was 172.20.0.x:80. (It is NOT the 9283 default published port for Grocy-Docker.) I also changed the "nextauth_url" to the RecipeBuddy container's manually-configured internal docker IP vs the host IP.

So for "GROCY_BASE_URL", the correct setting was "grocy_internal_container_ip:80", rather than "docker_host_ip:9283".

This is important to know. Helped me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants