MDeLuise / plant-it

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

Invalid API Key no matter what I use #336

Open Dvalin21 opened 1 month ago

Dvalin21 commented 1 month ago

Avoid duplicated bug reports

Description

Just as it say in the title. I look into the logs and it says that its using ForaCodex, but the moment I go to the frontend it say invalid API key. Not sure what could be causing this issue.

JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
plant-it-server-1  | 2024-10-22T07:00:26.557Z DEBUG 26 --- [           main] c.g.m.p.p.PlantInfoExtractorFacade       : FloraCodex service used
plant-it-server-1  | 2024-10-22T07:00:27.171Z  INFO 26 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path '/api'
plant-it-server-1  | 2024-10-22T07:00:27.187Z  INFO 26 --- [           main] c.github.mdeluise.plantit.Application    : Started Application in

Local environment

name: plant-it
services:
  server:
    image: msdeluise/plant-it-server:latest
    env_file: .env
    depends_on:
      - db
      - cache
    restart: unless-stopped
    volumes:
      - /home/incus/plantit/upload-dir:/upload-dir
      - /home/incus/docker/plantit/certs:/certificates
    ports:
      - 8881:8080
      - 3088:3000
  db:
    image: mysql:8.0
    restart: always
    env_file: .env
    volumes:
      - /home/incus/plantit/db:/var/lib/mysql
  cache:
    image: redis:7.2.1
    restart: always

Env

#
# DB
#
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_USERNAME=root
MYSQL_ROOT_PASSWORD=password
MYSQL_DATABASE=plantit
MYSQL_PSW=password

# JWT
#
JWT_SECRET=Secret
JWT_EXP=1

#
# Server config
#
USERS_LIMIT=2                # less then 0 means no limit
UPLOAD_DIR=/upload-dir
API_PORT=8080
FLORACODEX_KEY="key"
UPDATE_EXISTING=true
ALLOWED_ORIGINS=*                # CORS allowed origins (comma separated list)
CONTACT_MAIL=email
LOG_LEVEL=DEBUG                  # could be: DEBUG, INFO, WARN, ERROR
REMINDER_NOTIFY_CHECK=0 30 7 * * * # 6-values crontab expression to set the check time for reminders
MAX_REQUESTS_PER_MINUTE=100 # rate limiting of the upcoming requests
GOTIFY_ENABLED=true

#
# SSL
#
SSL_ENABLED=true
CERTIFICATE_PATH=/certificates/ # path to files to use for ssl. If on docker deployment leave as it is and change the volume binding in the docker-compose file if needed

#
# Cache
#
CACHE_TTL=86400
CACHE_HOST=cache
CACHE_PORT=6379

#
# SMTP
#
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_AUTH=true
SMTP_START_TTL=true
SMTP_EMAIL=email
SMTP_PASSWORD="password"
MDeLuise commented 1 month ago

Hi there,

Could you please confirm if the "invalid API key" message appears specifically when you are in the "Search" section, or does it also show up in other sections (like the Home page)?

Additionally, could you try running the following command in your shell to check if your FloraCodex key is working correctly (make sure to replace <your_key> with your actual API key):

curl -X GET "https://api.floracodex.com/v1/species/search?q=Monstera&page=0&limit=3&key=<your_key>"

Let me know if this returns a successful response or an error.

Dvalin21 commented 1 month ago

Hi there,

Could you please confirm if the "invalid API key" message appears specifically when you are in the "Search" section, or does it also show up in other sections (like the Home page)?

Additionally, could you try running the following command in your shell to check if your FloraCodex key is working correctly (make sure to replace <your_key> with your actual API key):

curl -X GET "https://api.floracodex.com/v1/species/search?q=Monstera&page=0&limit=3&key=<your_key>"

Let me know if this returns a successful response or an error. I get the invalid API key error before I even get to put in the server ip address.

{"data":[{"id":"609e2c34ca233f0aecfa9707","author":"Schott","common_name":"Adanson's Monstera","slug":"609e2c34ca233f0aecfa9707","scientific_name":"Monstera adansonii","status":"ACCEPTED","rank":"SPECIES","family":"Araceae","genus":"Monstera","genus_id":"609cccffb0f222c82c6204fe","image_url":"https://inaturalist-open-data.s3.amazonaws.com/photos/21333744/original.jpg","links":{"self":"/v1/species/609e2c34ca233f0aecfa9707","genus":"/v1/species/609cccffb0f222c82c6204fe","plant":"/v1/plants/609e2c34ca233f0aecfa9707"},"meta":{"last_modified":"2021-06-08T06:49:56.226Z"}},{"id":"609cccffb0f222c82c6204fe","author":"Adans.","slug":"609cccffb0f222c82c6204fe","scientific_name":"Monstera","status":"ACCEPTED","rank":"GENUS","family":"Araceae","genus":"Monstera","genus_id":"609cccffb0f222c82c6204fe","image_url":"https://inaturalist-open-data.s3.amazonaws.com/photos/73638885/original.jpg","links":{"self":"/v1/species/609cccffb0f222c82c6204fe","genus":"/v1/species/609cccffb0f222c82c6204fe","plant":"/v1/plants/609cccffb0f222c82c6204fe"},"meta":{"last_modified":"2021-06-08T06:15:14.336Z"}},{"id":"609e28e2ca233f0aecfa8bbd","author":"Liebm.","common_name":"Tarovine","slug":"609e28e2ca233f0aecfa8bbd","scientific_name":"Monstera deliciosa","status":"ACCEPTED","rank":"SPECIES","family":"Araceae","genus":"Monstera","genus_id":"609cccffb0f222c82c6204fe","image_url":"https://inaturalist-open-data.s3.amazonaws.com/photos/74267/original.jpg","links":{"self":"/v1/species/609e28e2ca233f0aecfa8bbd","genus":"/v1/species/609cccffb0f222c82c6204fe","plant":"/v1/plants/609e28e2ca233f0aecfa8bbd"},"meta":{"last_modified":"2021-06-08T06:34:03.150Z"}}],"self":"/v1/species/search?q=Monstera&page=0&limit=3&key=mykey","first":"/v1/species/search?q=Monstera&page=1&limit=3&key=mykey","next":"/v1/species/search?q=Monstera&page=1&limit=3&key=mykey","last":"/v1/species/search?q=Monstera&page=1&limit=3&key=mykey","meta":{"total":3}}
Dvalin21 commented 4 weeks ago
[error] | 16:18:20 815ms | Invalid API Key
[
    at Object.d (http://10.0.0.29:3088/main.dart.js:3426:19)
    at http://10.0.0.29:3088/main.dart.js:30943:9
    at aW6.a (http://10.0.0.29:3088/main.dart.js:4771:63)
    at aW6.$2 (http://10.0.0.29:3088/main.dart.js:43031:14)
    at aUV.$1 (http://10.0.0.29:3088/main.dart.js:43025:21)
    at Object.aVX (http://10.0.0.29:3088/main.dart.js:5044:19)
    at a0_.<anonymous> (http://10.0.0.29:3088/main.dart.js:118376:10)
    at a4W.r_ (http://10.0.0.29:3088/main.dart.js:44162:12)
    at aL0.$0 (http://10.0.0.29:3088/main.dart.js:43499:11)
    at Object.Ag (http://10.0.0.29:3088/main.dart.js:4919:40), null]