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

Crash when shoutrrr notifications are enabled but no URLs are specified #867

Closed
limpep opened this issue Mar 29, 2021 · 7 comments · Fixed by #869
Closed

Crash when shoutrrr notifications are enabled but no URLs are specified #867

limpep opened this issue Mar 29, 2021 · 7 comments · Fixed by #869

Comments

@limpep
Copy link

limpep commented Mar 29, 2021

Describe the bug
I updated to the latest version 1.2.1 but I am getting the following error

2021-03-29T08:52:34.143334096Z panic: runtime error: slice bounds out of range [:-2]
2021-03-29T08:52:34.143475927Z 
2021-03-29T08:52:34.143505723Z goroutine 1 [running]:
2021-03-29T08:52:34.143551278Z github.com/containrrr/watchtower/pkg/notifications.(*Notifier).String(0x1585d30, 0x775a08, 0x16)
2021-03-29T08:52:34.143581778Z 	/home/runner/work/watchtower/watchtower/pkg/notifications/notifier.go:61 +0x264
2021-03-29T08:52:34.143646833Z github.com/containrrr/watchtower/cmd.writeStartupMessage(0x15ba580, 0x0, 0x0, 0xd7f48b30, 0xe, 0xbfd670, 0x7924d0, 0x3f)
2021-03-29T08:52:34.143676555Z 	/home/runner/work/watchtower/watchtower/cmd/root.go:244 +0xd8
2021-03-29T08:52:34.143720702Z github.com/containrrr/watchtower/cmd.runUpgradesOnSchedule(0x15ba580, 0x1703698, 0x7924d0, 0x3f, 0x0, 0x0)
2021-03-29T08:52:34.143765924Z 	/home/runner/work/watchtower/watchtower/cmd/root.go:282 +0x1a0
2021-03-29T08:52:34.143810090Z github.com/containrrr/watchtower/cmd.Run(0x15ba580, 0xc0f744, 0x0, 0x0)
2021-03-29T08:52:34.143837127Z 	/home/runner/work/watchtower/watchtower/cmd/root.go:188 +0x2c8
2021-03-29T08:52:34.143912329Z github.com/spf13/cobra.(*Command).execute(0x15ba580, 0x140e0f8, 0x0, 0x0, 0x15ba580, 0x140e0f8)
2021-03-29T08:52:34.143937514Z 	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:842 +0x1e8
2021-03-29T08:52:34.143989384Z github.com/spf13/cobra.(*Command).ExecuteC(0x15ba580, 0x1458070, 0x0, 0x0)
2021-03-29T08:52:34.144016939Z 	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:943 +0x250
2021-03-29T08:52:34.144061124Z github.com/spf13/cobra.(*Command).Execute(...)
2021-03-29T08:52:34.144087901Z 	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:883
2021-03-29T08:52:34.144112697Z github.com/containrrr/watchtower/cmd.Execute()
2021-03-29T08:52:34.144156271Z 	/home/runner/work/watchtower/watchtower/cmd/root.go:70 +0x20
2021-03-29T08:52:34.144182493Z main.main()
2021-03-29T08:52:34.144223140Z 	/home/runner/work/watchtower/watchtower/main.go:13 +0x14

here is my docker compose file

watchtower:
   image: containrrr/watchtower:armhf-latest
   hostname: ${DOCKERHOSTNAME}
   container_name: watchtower
   environment:
     - REPO_PASS=${WATCHTOWER_REPO_PASS}
     - REPO_USER=${WATCHTOWER_REPO_USER}
     - TZ=${TZ}
     - WATCHTOWER_CLEANUP=${WATCHTOWER_CLEANUP}
     - WATCHTOWER_INCLUDE_STOPPED=${WATCHTOWER_INCLUDE_STOPPED}
     - WATCHTOWER_MONITOR_ONLY=${WATCHTOWER_MONITOR_ONLY}
     - WATCHTOWER_NOTIFICATION_TEMPLATE=${WATCHTOWER_NOTIFICATION_TEMPLATE}
     - WATCHTOWER_NOTIFICATION_URL=${WATCHTOWER_NOTIFICATION_URL}
     - WATCHTOWER_NOTIFICATIONS_LEVEL=${WATCHTOWER_NOTIFICATIONS_LEVEL}
     - WATCHTOWER_NOTIFICATIONS=${WATCHTOWER_NOTIFICATIONS}
     - WATCHTOWER_SCHEDULE=${WATCHTOWER_SCHEDULE}
     - WATCHTOWER_TIMEOUT=${WATCHTOWER_TIMEOUT}
   logging:
     driver: json-file
     options:
       max-file: ${DOCKERLOGGING_MAXFILE}
       max-size: ${DOCKERLOGGING_MAXSIZE}
   restart: unless-stopped
   volumes:
     - /etc/localtime:/etc/localtime:ro
     - /var/run/docker.sock:/var/run/docker.sock
     - ${DOCKERSTORAGEDIR}:/storage

here the env file

WATCHTOWER_CLEANUP=true
WATCHTOWER_ENABLED=true
WATCHTOWER_INCLUDE_STOPPED=false
WATCHTOWER_MONITOR_ONLY=false
WATCHTOWER_NETWORK_MODE=
WATCHTOWER_NOTIFICATIONS_LEVEL=info
WATCHTOWER_NOTIFICATIONS=shoutrrr
WATCHTOWER_NOTIFICATION_TEMPLATE={{range .}}{{.Message}}{{println}}{{end}}
WATCHTOWER_NOTIFICATION_URL=
WATCHTOWER_REPO_PASS=
WATCHTOWER_REPO_USER=
WATCHTOWER_SCHEDULE=0 0 4 * * *
WATCHTOWER_TIMEOUT=40s
  `.::///+:/-.        --///+//-:``    pi@raspberrypi
 `+oooooooooooo:   `+oooooooooooo:    --------------
  /oooo++//ooooo:  ooooo+//+ooooo.    OS: Raspbian GNU/Linux 10 (buster) armv7l
  `+ooooooo:-:oo-  +o+::/ooooooo:     Host: Raspberry Pi 4 Model B Rev 1.4
   `:oooooooo+``    `.oooooooo+-      Kernel: 5.10.17-v7l+
     `:++ooo/.        :+ooo+/.`       Uptime: 18 hours, 6 mins
        ...`  `.----.` ``..           Packages: 1895 (dpkg)
     .::::-``:::::::::.`-:::-`        Shell: bash 5.0.3
    -:::-`   .:::::::-`  `-:::-       Terminal: /dev/pts/0
   `::.  `.--.`  `` `.---.``.::`      CPU: BCM2711 (4) @ 1.500GHz
       .::::::::`  -::::::::` `       Memory: 1353MiB / 7874MiB
 .::` .:::::::::- `::::::::::``::.
-:::` ::::::::::.  ::::::::::.`:::-
::::  -::::::::.   `-::::::::  ::::
-::-   .-:::-.``....``.-::-.   -::-
 .. ``       .::::::::.     `..`..
   -:::-`   -::::::::::`  .:::::`
   :::::::` -::::::::::` :::::::.
   .:::::::  -::::::::. ::::::::
    `-:::::`   ..--.`   ::::::.
      `...`  `...--..`  `...`
            .::::::::::
             `.-::::-`

@simskij
Copy link
Member

simskij commented Mar 29, 2021

Hi!

Thank you for your report!

At a glance, it looks like something is malformed in the notification URL.

I know shoutrrr has had some changes in what is required so maybe @piksel wil be able to tell you more.

@piksel
Copy link
Member

piksel commented Mar 29, 2021

Ehm, it's empty as far as I can see? Not sure why it would fail with a index out of range though...

@piksel
Copy link
Member

piksel commented Mar 29, 2021

Ah, well, that makes sense, haha. Since shoutrrr notifications is enabled, it tries to list all the services it's sending to. But since no URL has been set it tries to remove the ", " separator from the last service (which doesn't exist).
The easiest fix for @limpep right now is to either add some notifiaction to the WATCHTOWER_NOTIFICATION_URL or clear the value of WATCHTOWER_NOTIFICATIONS.

@piksel piksel changed the title Error starting on pi 4 Crash when shoutrrr notifications are enabled but no URLs are specified Mar 29, 2021
@simskij
Copy link
Member

simskij commented Mar 29, 2021

I just assumed it was redacted, but yeah. 😅 If you indeed do have an URL specified, please paste it but with some of the characters replaced either with something else or with asterisks.

Thanks!

@limpep
Copy link
Author

limpep commented Mar 29, 2021

Can confirm clearing WATCHTOWER_NOTIFICATIONS has helped.

@simskij simskij closed this as completed Mar 29, 2021
@ghost
Copy link

ghost commented Mar 29, 2021

To avoid important communication to get lost in a closed issues no one monitors, I'll go ahead and lock this issue. If you want to continue the discussion, please open a new issue. Thank you! 🙏🏼

@ghost ghost locked as resolved and limited conversation to collaborators Mar 29, 2021
@piksel
Copy link
Member

piksel commented Mar 30, 2021

Reopening this, since there is actually a bug here.

@piksel piksel reopened this Mar 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants