Vikunja Emails fail with panic

Good afternoon,

I have a new Vikunja instance v0.24.4. I’m looking to put it in production with email sending through gmail. Running docker compose with environmental variables pushed through the compose yml. I have successfully tested email with “vikunja testemail” log below, and enabled mail with the env variable, but it appears when Vikunja has a trigger for an email send, we get this panic error. I have the logs below.

Any thoughts?

############################################
###test email successful
############################################
2024-11-21T19:37:57Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-21T19:37:57Z: INFO      ▶ 002 Sending testmail...
2024-11-21T19:38:00Z: DEBUG     ▶ 2de [Task Reminder Cron] Looking for reminders between 2024-11-21 13:38:00 -0600 CST and 2024-11-21 13:39:00 -0600 CST to send...
2024-11-21T19:38:00Z: DEBUG     ▶ 2e1 [Undone Overdue Tasks Reminder] Sending reminders to 0 users
2024-11-21T19:38:00Z: DEBUG     ▶ 2e5 [Task Reminder Cron] Found 1 reminders
2024-11-21T19:38:00Z: INFO      ▶ 01b Testmail successfully sent.


############################################
####error when assigning a user to a task and vikunja should trigger an email send
####logs are sanitized....
############################################
2024-11-21T19:33:45Z: ERROR     ▶ 231 Error while handling message 7f453104-aa6a-4e50-8bda-8139a3ec4641, subscriber_poisoned=gochannel.GoChannel, reason_poisoned=panic occurred: "invalid memory address or nil pointer dereference", stacktrace: 
goroutine 298 [running]:
runtime/debug.Stack()
        /go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.1.linux-amd64/src/runtime/debug/stack.go:26 +0x5e
github.com/ThreeDotsLabs/watermill/message/router/middleware.Recoverer.func1.1()
        /go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.7/message/router/middleware/recoverer.go:29 +0x50
panic({0x1681380?, 0x4a107c0?})
        /go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.1.linux-amd64/src/runtime/panic.go:785 +0x132
github.com/typesense/typesense-go/v2/typesense.GenericCollection[...](...)
        /go/pkg/mod/github.com/typesense/typesense-go/v2@v2.0.0/typesense/client.go:32
github.com/typesense/typesense-go/v2/typesense.(*Client).Collection(...)
        /go/pkg/mod/github.com/typesense/typesense-go/v2@v2.0.0/typesense/client.go:36
code.vikunja.io/api/pkg/models.reindexTasksInTypesense(0xc00071c000, 0xc00063dae0)
        /go/src/code.vikunja.io/api/pkg/models/typesense.go:325 +0x42d
code.vikunja.io/api/pkg/models.(*UpdateTaskInSavedFilterViews).Handle(0x3defc18?, 0xc0002d5680)
        /go/src/code.vikunja.io/api/pkg/models/listeners.go:734 +0xefd
github.com/ThreeDotsLabs/watermill/message.(*Router).AddNoPublisherHandler.func1(0xc0005087e0?)
        /go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.7/message/router.go:338 +0x17
github.com/ThreeDotsLabs/watermill/message/router/middleware.Recoverer.func1(0xc00063dd50?)
        /go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.7/message/router/middleware/recoverer.go:33 +0x70
github.com/ThreeDotsLabs/watermill/message/router/middleware.Retry.Middleware-fm.Retry.Middleware.func1(0xc0002d5680)
        /go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.7/message/router/middleware/retry.go:72 +0x27e
github.com/ThreeDotsLabs/watermill/message/router/middleware.poisonQueue.Middleware-fm.poisonQueue.Middleware.func1(0x169d9a0?)
        /go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.7/message/router/middleware/poison.go:99 +0xa2
github.com/ThreeDotsLabs/watermill/components/metrics.HandlerPrometheusMetricsMiddleware.Middleware-fm.HandlerPrometheusMetricsMiddleware.Middleware.func1(0xc0002d5680)
        /go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.7/components/metrics/handler.go:58 +0x19b
github.com/ThreeDotsLabs/watermill/message.(*handler).handleMessage(0xc000442410, 0xc0002d5680, 0xc000532030)
        /go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.7/message/router.go:783 +0x15b
created by github.com/ThreeDotsLabs/watermill/message.(*handler).run in goroutine 141
        /go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.7/message/router.go:628 +0x2a5
, topic_poisoned=task.updated, handler_poisoned=task.updated.task.set.saved.filter.views,  payload={"task":{"id":169,"title":"task 44","description":"\u003cp\u003e\u003c/p\u003e","done":false,"done_at":"0001-01-01T00:00:00Z","due_date":"0001-01-01T00:00:00Z","reminders":null,"project_id":1,"repeat_after":0,"repeat_mode":0,"priority":0,"start_date":"0001-01-01T00:00:00Z","end_date":"0001-01-01T00:00:00Z","assignees":null,"labels":null,"hex_color":"","percent_done":0,"identifier":"","index":6,"related_tasks":null,"attachments":null,"cover_image_attachment_id":0,"is_favorite":false,"created":"2024-11-21T13:32:41-06:00","updated":"2024-11-21T13:32:54-06:00","bucket_id":0,"position":0,"reactions":null,"created_by":null},"doer":{"id":1,"name":"","username":"tester","email":"test@test.org","created":"0001-01-01T00:00:00Z","updated":"0001-01-01T00:00:00Z"}}


####################################################
####env variables
###################################################
      VIKUNJA_SERVICE_PUBLICURL: ****
      VIKUNJA_SERVICE_JWTSECRET: ****
      VIKUNJA_DATABASE_HOST: *****
      VIKUNJA_DATABASE_PASSWORD: *****
      VIKUNJA_DATABASE_TYPE: postgres
      VIKUNJA_DATABASE_USER: ******
      VIKUNJA_DATABASE_DATABASE: ******
      VIKUNJA_SERVICE_ENABLEREGISTRATION: false
      VIKUNJA_SERVICE_TIMEZONE: "America/Chicago"
      VIKINJA_SERVICE_CUSTOMLOGOURL: *****
      VIKUNJA_CUSTOM_LOGO_URL: *****
      VIKUNJA_LOG_PATH: /app/vikunja/files
      VIKUNJA_LOG_STANDARD: file
      VIKUNJA_LOG_LEVEL: DEBUG
      VIKUNJA_MAILER_FORCESSL: true
      VIKUNJA_MAILER_HOST: smtp.gmail.com
      VIKUNJA_MAILER_PORT: 465
      VIKUNJA_MAILER_USERNAME: *****
      VIKUNJA_MAILER_PASSWORD: *****
      VIKUNJA_SERVICE_ENABLEEMAILREMINDERS: true
      VIKUNJA_LOG_MAIL: file
      VIKUNJA_LOG_MAILLEVEL: DEBUG
      VIKUNJA_MAILER_ENABLED: true

This is unrelated to sending mail and instead a bug in the typesense integration. It is already fixed in the latest unstable build.

Awesome, much appreciated.

Unfortunately, I’ve jumped to the latest unstable image (vikunja/vikunja:unstable, v0.24.1-486-5edccba028, checksum sha256:a59a221509edbd25ec3c0e51e9831082d0946348a820f9dda3e71444eec4c192) and the issue seems to have changed, not resolved? At least I’m 80% sure this is the most recent unstable release from a bit ago?

I no longer get an error message from mail logs, in fact, I don’t get any error messages at all. I attempted to assign tasks to myself and set reminders that pass during my logging time, comment, neither seem to do anything? I see the actions are caught in logs. The reminders are found and do fall into the minute the search is looking for, but I never receive an email nor is one sent, and no mail error logs are posted?

I created Task 172 for this log set. Assigned myself to task and commented. Nothing came received, nothing in sent mail, no mail logs.

2024-11-22T15:05:25Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:05:25Z: INFO      ▶ 002 Running migrations…
2024-11-22T15:05:25Z: INFO      ▶ 06d Ran all migrations successfully.
2024-11-22T15:05:25Z: DEBUG     ▶ 06e [Task Reminder Cron] Timezone is America/Chicago
2024-11-22T15:05:25Z: INFO      ▶ 06f Vikunja version v0.24.1-486-5edccba028
2024-11-22T15:05:30Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:05:35Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:05:40Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:05:45Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:05:50Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:05:55Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:06:00Z: DEBUG     ▶ 0eb [Task Reminder Cron] Looking for reminders between 2024-11-22 09:06:00 -0600 CST and 2024-11-22 09:07:00 -0600 CST to send...
2024-11-22T15:06:00Z: DEBUG     ▶ 0ee [Undone Overdue Tasks Reminder] Sending reminders to 0 users
2024-11-22T15:06:00Z: DEBUG     ▶ 0f0 [Task Reminder Cron] Found 4 reminders
2024-11-22T15:06:00Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:06:04Z: DEBUG     ▶ 0fb Initials avatar for user 1 and size 50 not cached, creating...
2024-11-22T15:06:04Z: DEBUG     ▶ 0fc Initials avatar for user 1 not cached, creating...
2024-11-22T15:06:05Z: DEBUG     ▶ 123 Initials avatar for user 1 and size 25 not cached, creating...
2024-11-22T15:06:05Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:06:07Z: DEBUG     ▶ 134 Initials avatar for user 1 and size 48 not cached, creating...
2024-11-22T15:06:07Z: DEBUG     ▶ 136 Initials avatar for user 1 and size 30 not cached, creating...
2024-11-22T15:06:08Z: DEBUG     ▶ 15c Did not find any webhook for the task.updated event for project 1, not sending
2024-11-22T15:06:08Z: DEBUG     ▶ 162 Did not find any webhook for the task.assignee.deleted event for project 1, not sending
2024-11-22T15:06:08Z: DEBUG     ▶ 169 Did not find filter for view 136
2024-11-22T15:06:08Z: DEBUG     ▶ 16a Did not find filter for view 140
2024-11-22T15:06:09Z: DEBUG     ▶ 171 Serving initials avatar for user 1 and size 50 from cache
2024-11-22T15:06:09Z: DEBUG     ▶ 174 Serving initials avatar for user 1 and size 50 from cache
2024-11-22T15:06:10Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:06:13Z: DEBUG     ▶ 1c4 Did not find any webhook for the task.assignee.deleted event for project 1, not sending
2024-11-22T15:06:13Z: DEBUG     ▶ 1c8 Did not find filter for view 136
2024-11-22T15:06:13Z: DEBUG     ▶ 1c9 Did not find filter for view 140
2024-11-22T15:06:13Z: DEBUG     ▶ 1cd Did not find any webhook for the task.updated event for project 1, not sending
2024-11-22T15:06:15Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:06:18Z: DEBUG     ▶ 201 Did not find any webhook for the task.created event for project 1, not sending
2024-11-22T15:06:18Z: DEBUG     ▶ 20a Did not find filter for view 136
2024-11-22T15:06:18Z: DEBUG     ▶ 20b Did not find filter for view 140
2024-11-22T15:06:21Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:06:23Z: DEBUG     ▶ 22a Initials avatar for user 1 and size 24 not cached, creating...
2024-11-22T15:06:24Z: DEBUG     ▶ 257 Did not find any webhook for the task.assignee.created event for project 1, not sending
2024-11-22T15:06:24Z: DEBUG     ▶ 25e Did not find any webhook for the task.updated event for project 1, not sending
2024-11-22T15:06:24Z: DEBUG     ▶ 262 Sending task assigned notifications to 1 subscribers for task 172
2024-11-22T15:06:24Z: DEBUG     ▶ 269 Did not find filter for view 136
2024-11-22T15:06:24Z: DEBUG     ▶ 26a Did not find filter for view 140
2024-11-22T15:06:26Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:06:28Z: DEBUG     ▶ 291 Did not find any webhook for the task.comment.created event for project 1, not sending
2024-11-22T15:06:28Z: DEBUG     ▶ 295 Sending task comment notifications to 1 subscribers for task 172
2024-11-22T15:06:28Z: DEBUG     ▶ 299 Initials avatar for user 1 and size 20 not cached, creating...
2024-11-22T15:06:31Z: INFO      ▶ 001 No config file found, using default or config from environment variables.
2024-11-22T15:06:36Z: INFO      ▶ 001 No config file found, using default or config from environment variables.

Just kidding. I realize that when I assign myself to things, I do not get emails, but if others assign me, I do. I think that’s expected :slight_smile: So it’s working on unstable :slight_smile:

Yes, that’s expected :slightly_smiling_face: