mattermost-plugin-jira icon indicating copy to clipboard operation
mattermost-plugin-jira copied to clipboard

Notifications are not coming. Error Unable to save the Post

Open Sadisms opened this issue 1 year ago • 5 comments

Hi, we stopped receiving notifications for some events, according to the logs, this is an error {"timestamp":"2024-03-21 11:18:31.454 Z","level":"error","msg":"WebhookWorker id: 2, error posting to channel, err: CreatePost: Unable to save the Post.","caller":"app/plugin_api.go:1003","plugin_id":"jira"} {"timestamp":"2024-03-21 11:18:34.467 Z","level":"error","msg":"WebhookWorker id: 3, error posting to channel, err: CreatePost: Unable to save the Post.","caller":"app/plugin_api.go:1003","plugin_id":"jira"}

Sadisms avatar Mar 21 '24 12:03 Sadisms

Hi @Sadisms, thanks for filing this issue. Can you please set your log level to DEBUG if not already set? There may be some more logs related to this near this log line. Thank you!

mickmister avatar Mar 28 '24 15:03 mickmister

Hi @mickmister , sorry for the very late reply, the error still appears, debug log is enabled, no strange logs are seen, here is an example:

{"timestamp":"2024-05-23 05:00:27.431 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:187","method":"POST","url":"/api/v4/users/ids","request_id":"tuicm7cx37re3k8iscr9th58se","user_id":"a56gykefwpduf84k4eopygq>
{"timestamp":"2024-05-23 05:00:27.440 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:187","method":"POST","url":"/api/v4/users/status/ids","request_id":"x8cxw5ce7t83zneno69uia46xy","user_id":"kpo3mtp5hp8mi8sx>
{"timestamp":"2024-05-23 05:00:27.444 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:187","method":"GET","url":"/api/v4/users/me","request_id":"hoo7ke5au3dmtmbfxzwwj1hgko","user_id":"jimjbexcm7f67rg8rmy1ntszz>
{"timestamp":"2024-05-23 05:00:27.446 Z","level":"error","msg":"WebhookWorker id: 7, error posting to channel, err: CreatePost: Unable to save the Post.","caller":"app/plugin_api.go:1003","plugin_id":"jira"}
{"timestamp":"2024-05-23 05:00:27.449 Z","level":"debug","msg":"Websocket request","caller":"wsapi/websocket_handler.go:26","action":"user_update_active_status"}
{"timestamp":"2024-05-23 05:00:27.450 Z","level":"debug","msg":"Websocket request","caller":"wsapi/websocket_handler.go:26","action":"user_update_active_status"}
{"timestamp":"2024-05-23 05:00:27.451 Z","level":"debug","msg":"Websocket request","caller":"wsapi/websocket_handler.go:26","action":"user_update_active_status"}

Sadisms avatar May 23 '24 06:05 Sadisms

@mickmister Explored a bit on this, the issue seems to be on the mattermost side(internal server error from their side), here is the permalink for the line from mattermost server which appears to be the source of the error.

On the Jira side, there seems to be no code that can cause this error. The only point from where an error can be returned is the call to the createPost function of the mattermost server. Here are some related permalinks. errorSouce, createPost Call

Kshitij-Katiyar avatar Jun 27 '24 14:06 Kshitij-Katiyar

@Kshitij-Katiyar That's strange that we don't have a more descriptive error here

From the code that prepares the post in the plugin, it looks like we only populate:

  • ChannelId
  • UserId
  • Message
  • Props.Attachments (conditionally)

https://github.com/mattermost/mattermost-plugin-jira/blob/1b9490bffa36a6ec4fcc0b521a82885f3d1408bd/server/webhook.go#L63-L100

I'm thinking there may be an issue with the channel id provided. Maybe the channel is archived?

mickmister avatar Jun 27 '24 15:06 mickmister

@Kshitij-Katiyar That's strange that we don't have a more descriptive error here

From the code that prepares the post in the plugin, it looks like we only populate:

  • ChannelId
  • UserId
  • Message
  • Props.Attachments (conditionally)

https://github.com/mattermost/mattermost-plugin-jira/blob/1b9490bffa36a6ec4fcc0b521a82885f3d1408bd/server/webhook.go#L63-L100

I'm thinking there may be an issue with the channel id provided. Maybe the channel is archived?

@mickmister @wiggin77 I tried a few cases, but this error does not seem to reproduce:

  • Archived Channel: The message gets posted regardless. Screenshot from 2024-06-30 18-30-16

  • Closed Channel: No message is posted in this case, but no error is logged in the system logs.

Kshitij-Katiyar avatar Jul 01 '24 06:07 Kshitij-Katiyar

@Sadisms Are you still facing this issue or can we close it?

Kshitij-Katiyar avatar Aug 02 '24 10:08 Kshitij-Katiyar

Closing for now, can reopen if someone faces the issue.

raghavaggarwal2308 avatar Aug 06 '24 07:08 raghavaggarwal2308