MDeLuise / plant-it

🪴 Self-hosted, open source gardening companion app
https://plant-it.org
GNU General Public License v3.0
686 stars 25 forks source link

405 error #138

Closed Szymok closed 8 months ago

Szymok commented 8 months ago

Avoid duplicated bug reports

Description

After deploying the plant-it app on a Raspberry Pi using Portainer and Ubuntu, I encounter a 405 error when attempting to create an account or log in. The error message is displayed in a popup with an empty message body.

image

version: "3"
name: plant-it
services:
  backend:
    image: msdeluise/plant-it-backend:latest
    env_file: stack.env
    depends_on:
      - db
      - cache
    restart: unless-stopped
    volumes:
      - "./upload-dir:/upload-dir"
      - "./certificates:/certificates"
    ports:
      - "9092:8080"

  db:
    image: mysql:8.0
    restart: always
    env_file: stack.env
    volumes:
      - "./db:/var/lib/mysql"
    ports:
      - "3307:3306"

  cache:
    image: redis:7.2.1
    restart: always

  frontend:
    image: msdeluise/plant-it-frontend:latest
    env_file: stack.env
    links:
      - backend
    ports:
      - "3090:3000"
    volumes:
      - "./certificates:/certificates"
volumes:
  certs:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: ./certificates

Expected behaviour

I would expect the account creation or login process to complete successfully without any errors, allowing me to access the plant-it app's features.

Steps to reproduce

Deploy the plant-it app using the provided docker-compose file on a Raspberry Pi with Portainer and Ubuntu. Navigate to the frontend service on port 3090. Attempt to create a new account or log in with existing credentials. Observe the 405 error in a popup window.

Local environment

Raspberry Pi model: 4B Ubuntu version: 22.01 Portainer version: 2.19.4 Browser and version: Edge v122.0.2365.92

Additional info

The docker-compose file has been configured to expose the backend service on port 9092 and the frontend on port 3090. The database service is exposed on port 3307. The error occurs when the frontend service makes a POST request to the /api/authentication/signup endpoint. Screenshot of the error is attached (attach the screenshot you provided).

MDeLuise commented 8 months ago

Hi @Szymok, thanks for opening the issue Could you please provide the backend.env and frontend.env file you are using? It would be also useful to have the docker compose log

Szymok commented 8 months ago

Here is my stack.env which i am using in portainer, The differenxe is that i removed one var that was duplicated. Screenshot_2024-03-19-01-09-43-74_df198e732186825c8df26e3c5a10d7cd.jpg

Docker compose olgs? From containers?

MDeLuise commented 8 months ago

Usually on pc the docker compose log is shown running docker-compose logs, but I see that you're using a mobile client and I don't know how you can retrieve it from that.

Anyway I think the problem could be related to the API_URL parameter, you set it as http://192.168.101.20:3090/api, but the backend service is exposed at port 9092 in your deployment. So I think someone else is responding to the frontend request.

Please try to modify the API_URL to http://192.168.101.20:9092/api, and let me know if this fix the problem.

Szymok commented 8 months ago

Yay, what a stupid mistake from my side! Thank you for help, i am gonna to add all my plants to this app :D

MDeLuise commented 8 months ago

Glad to know that the problem is now fixed, and thanks for using the project! 😁 Happy planting 🪴