containrrr / watchtower

A process for automating Docker container base image updates.
https://containrrr.dev/watchtower/
Apache License 2.0
19.71k stars 869 forks source link

Cannot recieve a notification in a json format #2041

Open QKrempp opened 1 month ago

QKrempp commented 1 month ago

Describe the bug

Watchtower seems to fail to provide a notification in a valid json format at least when using a generic webhook.

Steps to reproduce

  1. Create a new docker compose file like the following:
    version: "3.3"
    services:
    watchtower:
    restart: unless-stopped
    container_name: watchtower_test
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    image: containrrr/watchtower
    environment:
      WATCHTOWER_NOTIFICATION_URL: get a test url from webhook.site and replace "https" with "generic"
  2. Run docker compose up -d
  3. See the interface in Webhook.site, and check Request detail > Raw content
  4. See the "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" banner at the top This is causing the app supposed to recieve the data to fail to parse it in my setup

Expected behavior

Recieved data is a valid JSON (as it is supposed to be the default format)

Screenshots

No response

Environment

Your logs

watchtower_test  | time="2024-10-17T19:22:14Z" level=debug msg="Sleeping for a second to ensure the docker api client has been properly initialized."
watchtower_test  | time="2024-10-17T19:22:15Z" level=debug msg="Making sure everything is sane before starting"
watchtower_test  | time="2024-10-17T19:22:15Z" level=debug msg="Retrieving running containers"
watchtower_test  | time="2024-10-17T19:22:15Z" level=debug msg="There are no additional watchtower containers"
watchtower_test  | time="2024-10-17T19:22:15Z" level=debug msg="Watchtower HTTP API skipped."
watchtower_test  | time="2024-10-17T19:22:15Z" level=info msg="Watchtower 1.7.1"
watchtower_test  | time="2024-10-17T19:22:15Z" level=info msg="Using notifications: generic"
watchtower_test  | time="2024-10-17T19:22:15Z" level=info msg="Checking all containers (except explicitly disabled with label)"
watchtower_test  | time="2024-10-17T19:22:15Z" level=info msg="Scheduling first run: 2024-10-18 19:22:15 +0000 UTC"
watchtower_test  | time="2024-10-17T19:22:15Z" level=info msg="Note that the first check will be performed in 23 hours, 59 minutes, 59 seconds"
watchtower_test  | Server response: This URL has no default content configured. <a href="https://webhook.site/#!/view/REDACTED">View in Webhook.site</a>.

Additional context

No response

github-actions[bot] commented 1 month ago

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏