diun
diun copied to clipboard
PushOver notification not working with error
Behaviour
Test notifications with PushOver configured doesn't work. Tested on a Raspberry Pi 4 and on a VPS. Same behaviour.
Steps to reproduce this issue
- Configure PushOver notifier with environment variables in docjer compose file.
- Run command "docker-compose exec diun diun notif test"
Expected behaviour
Receive PushOver notification
Actual behaviour
No notification receiver on PushOver account and found error in diun container logs. Container exits after error.
Configuration
- Diun version :
- Platform (windows/linux) : Raspberry OS Debian GNU/Linux 11 (bullseye) and Rocky Linux release 8.5 (Green Obsidian)
- System info (type
uname -a
) : Linux XXXXXXXXXX 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux Linux XXXXXXXXXX 4.18.0-348.12.2.el8_5.x86_64 #1 SMP Wed Jan 19 17:53:40 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Paste your configuration files here
version: '3.5'
services:
diun: 4.21.0
image: crazymax/diun:latest
container_name: diun
command: serve
volumes:
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- TZ=Europe/Rome
- LOG_LEVEL=info
- LOG_JSON=false
- DIUN_WATCH_WORKERS=20
- DIUN_WATCH_SCHEDULE=0 */6 * * *
- DIUN_PROVIDERS_DOCKER=true
- DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT=true
- DIUN_NOTIF_PUSHOVER_TOKEN=XXX
- DIUN_NOTIF_PUSHOVER_RECIPIENT=XXX
- DIUN_NOTIF_PUSHOVER_TEMPLATETITLE={{ .Entry.Image }} {{ if (eq .Entry.Status new) }}is available{{ else }}has been updated{{ end }}
- DIUN_NOTIF_PUSHOVER_TEMPLATEBODY=Docker tag {{ if .Entry.Image.HubLink }}[**{{ .Entry.Image }}**]({{ .Entry.Image.HubLink }}){{ else }}**{{ .Entry.Image }}**{{ end }} which you subscribed to through {{ .Entry.Provider }} provider {{ if (eq .Entry.Status new) }}is available{{ else }}has been updated{{ end }} on {{ .Entry.Image.Domain }} registry (triggered by {{ .Meta.Hostname }} host).
restart: unless-stopped
Logs
diun | panic: template: title:1: function "new" not defined
diun |
diun | goroutine 396 [running]:
diun | text/template.Must(...)
diun | text/template/helper.go:25
diun | github.com/crazy-max/diun/v4/internal/msg.(*Client).RenderMarkdown(0x4000bdb530)
diun | github.com/crazy-max/diun/v4/internal/msg/client.go:42 +0x704
diun | github.com/crazy-max/diun/v4/internal/msg.(*Client).RenderHTML(0x4000095530)
diun | github.com/crazy-max/diun/v4/internal/msg/client.go:74 +0x28
diun | github.com/crazy-max/diun/v4/internal/notif/pushover.(*Client).Send(0x400013e960, {{0x14c2432, 0x3}, {0x14c322e, 0x4}, {{0x40004c4040, 0x9}, {0x40004c404a, 0xe}, {0x40004c4059, ...}, ...}, ...})
diun | github.com/crazy-max/diun/v4/internal/notif/pushover/client.go:58 +0x270
diun | github.com/crazy-max/diun/v4/internal/grpc.(*Client).NotifTest(0x4000734360, {0x17abac0, 0x40006061b0}, 0x40006061e0)
diun | github.com/crazy-max/diun/v4/internal/grpc/notif.go:63 +0x75c
diun | github.com/crazy-max/diun/v4/pb._NotifService_NotifTest_Handler({0x13bb580, 0x4000734360}, {0x17abac0, 0x40006061b0}, 0x4000910060, 0x0)
diun | github.com/crazy-max/diun/v4/pb/notif_grpc.pb.go:79 +0x1bc
diun | google.golang.org/grpc.(*Server).processUnaryRPC(0x400047e1c0, {0x17d70e0, 0x4000abd860}, 0x40004b8000, 0x4000734510, 0x2476ad0, 0x0)
diun | google.golang.org/[email protected]/server.go:1282 +0xc3c
diun | google.golang.org/grpc.(*Server).handleStream(0x400047e1c0, {0x17d70e0, 0x4000abd860}, 0x40004b8000, 0x0)
diun | google.golang.org/[email protected]/server.go:1616 +0xa54
diun | google.golang.org/grpc.(*Server).serveStreams.func1.2(0x40003a6050, 0x400047e1c0, {0x17d70e0, 0x4000abd860}, 0x40004b8000)
diun | google.golang.org/[email protected]/server.go:921 +0x94
diun | created by google.golang.org/grpc.(*Server).serveStreams.func1
diun | google.golang.org/[email protected]/server.go:919 +0x1f0
diun exited with code 0
It's explained in the stack:
panic: template: title:1: function "new" not defined
DIUN_NOTIF_PUSHOVER_TEMPLATETITLE
is wrong.
{{ if (eq .Entry.Status new) }}
should be {{ if (eq .Entry.Status "new") }}
.
But it should not panic though. Will fix that.