Skip to content

TLS cert breaks MQTT images #587

@TheMangrove

Description

@TheMangrove

PLEASE READ THE DOCUMENTATION BEFORE SUBMITTING AN ISSUE

Describe the bug
using a custom domain and tls breaks sending images over mqtt

To Reproduce
Installed cert using custom domain and tls in caddy file. I also set an http>https redirect.

Expected behavior
I'm trying to send notifications via MQTT. Everything was working before I switched to tls and https.

Additional context
This is the error message now when I try and send a test message:

IMAGE API ERROR: HTTPSConnectionPool(host='localhost', port=443): Max retries exceeded with url: /api/v1/image/Turdus%20migratorius (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1029)')))
[apprise][INFO] Loaded 1 entries from file:///tmp/phpeikmijvk0rbo09WLhpr?encoding=utf-8&cache=yes
[apprise][INFO] Sent MQTT notification

Your build
Raspberry Pi 4B
Latest BirdNet-Pi biuld

From what I can tell, the website I have set under Custom URL (birdnet.mydomain.com) is not getting passed on to apprise which is trying to use "localhost" for the image. This causes things to break.

Possible fix

BirdNET-Pi/tree/main/scripts/utils/notifications.py

line 87

url = f"http://localhost/api/v1/image/{sci_name}"

Change to:

url = f"{websiteurl}/api/v1/image/{sci_name}"

Seems to fix it for me. I don't however know what effect this will have for people who leave that field blank. There is probably a better fix for this but I'm no expert and just sorta brute force things. Maybe setting a default entry for websiteurl such as birdnet.local would work?

Open to other suggestions on how to better resolve this that doesn't require changing notifications.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions