Discourse and Mattermost fails


(HĂ„kan Eriksson) #1

I have set up Mattermost notifications using the discourse-chat-integration plugin with incoming webhook and slashcommands.

Anyone got an idea?

I got this error - seen on my Mattermost log.

[2017/10/21 13:58:49 CEST] [EROR] /hooks/xu1sufehopdr8mwmfecq7uqfaa:CreateWebhookPost code=500 rid=tsufqba5e38uzfb7qfb5754hew uid= ip=5.189.176.198 Error creating post [details: err=store.sql_post.save.app_error]

Discourse log shows: DiscourseChat::ProviderError

/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/mattermost/mattermost_provider.rb:26:in `send_via_webhook'
/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/mattermost/mattermost_provider.rb:78:in `trigger_notification'
/var/www/discourse/plugins/discourse-chat-integration/app/services/manager.rb:83:in `block in trigger_notifications'
/var/www/discourse/plugins/discourse-chat-integration/app/services/manager.rb:76:in `each'
/var/www/discourse/plugins/discourse-chat-integration/app/services/manager.rb:76:in `trigger_notifications'
/var/www/discourse/plugins/discourse-chat-integration/app/jobs/regular/notify_chats.rb:7:in `execute'
/var/www/discourse/app/jobs/base.rb:134:in `block (2 levels) in perform'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:71:in `with_connection'
/var/www/discourse/app/jobs/base.rb:129:in `block in perform'
/var/www/discourse/app/jobs/base.rb:125:in `each'
/var/www/discourse/app/jobs/base.rb:125:in `perform'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:188:in `execute_job'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:170:in `block (2 levels) in process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
/var/www/discourse/lib/sidekiq/pausable.rb:79:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/middleware/chain.rb:133:in `invoke'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:169:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:141:in `block (6 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/job_retry.rb:97:in `local'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:140:in `block (5 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq.rb:36:in `block in <module:Sidekiq>'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:136:in `block (4 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:204:in `stats'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:131:in `block (3 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/job_logger.rb:7:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:130:in `block (2 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/job_retry.rb:72:in `global'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:129:in `block in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/logging.rb:44:in `with_context'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/logging.rb:38:in `with_job_hash_context'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:128:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:168:in `process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:85:in `process_one'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:73:in `run'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/util.rb:16:in `watchdog'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/sidekiq-5.0.5/lib/sidekiq/util.rb:25:in `block in safe_thread'

(David Taylor) #2

This looks like an issue within the mattermost application, so there might not be anything wrong on the Discourse end.

In your Discourse logs, please can you navigate to the “info” tab for the error, and paste the content here?


(HĂ„kan Eriksson) #3

The info tab i discourse log:

Job exception: DiscourseChat::ProviderError

The env tab from same log:

message	Triggering notifications failed
extra	
provider_name	mattermost
channel	[#<DiscourseChat::Channel:0x007f2c19d1d138>, #<DiscourseChat::Channel:0x007f2c177cd9a0>, #<DiscourseChat::Channel:0x007f2c33161d48>]
post_id	[114, 115, 117]
error_info	null
request	[{"channel":"#orebro-tribune","username":"Örebro Tribune .COM","icon_url":"http://orebrotribune.com/uploads/default/original/1X/a662b41605bd0153fac9e50d00f018e73cd4131d.png","attachments":[{"fallback":"Vi hyllar maten i ett socialt nĂ€tverk – dela dina Mattips.Online - HĂ„kan Eriksson @erikxxon","author_name":"HĂ„kan Eriksson @erikxxon","author_icon":"//orebrotribune.com/user_avatar/orebrotribune.com/erikxxon/45/3_1.png","color":"#25628E","text":"Nu Ă€r vi klara och har öppnat upp systemet, det sociala nĂ€tverket Mattips.Online \nPĂ„ Mattips.Online sĂ„ kan du dela med dig av dina lĂ€nkar, menyer, recept, supertips och trix som mĂ„nga vill veta. Du kan i varje av dina inlĂ€gg (toot) anvĂ€nda upp till 500 tecken, nyttja vĂ„ra grymma funktioner pĂ„ mattips.online. \nSammanslutna anvĂ€ndare – oberoende pĂ„ server\nSystemet vi byggt upp Mattips.Online heter M...","title":"Vi hyllar maten i ett socialt nĂ€tverk – dela dina Mattips.Online [Örebro Tribune] ","title_link":"http://orebrotribune.com/t/vi-hyllar-maten-i-ett-socialt-natverk-dela-dina-mattips-online/59/1"}]}, {"channel":"#orebro-tribune","username":"Örebro Tribune .COM","icon_url":"http://orebrotribune.com/uploads/default/original/1X/a662b41605bd0153fac9e50d00f018e73cd4131d.png","attachments":[{"fallback":"Vi hyllar maten i ett socialt nĂ€tverk – dela dina Mattips.Online - HĂ„kan Eriksson @erikxxon","author_name":"HĂ„kan Eriksson @erikxxon","author_icon":"//orebrotribune.com/user_avatar/orebrotribune.com/erikxxon/45/3_1.png","color":"#25628E","text":"Testar om denna far vidare","title":"Vi hyllar maten i ett socialt nĂ€tverk – dela dina Mattips.Online [Örebro Tribune] ","title_link":"http://orebrotribune.com/t/vi-hyllar-maten-i-ett-socialt-natverk-dela-dina-mattips-online/59/2"}]}, {"channel":"#orebro-tribune","username":"Örebro Tribune .COM","icon_url":"http://orebrotribune.com/uploads/default/original/1X/a662b41605bd0153fac9e50d00f018e73cd4131d.png","attachments":[{"fallback":"Team Chatter kan du i realtid chatta med oss vid redaktionen - HĂ„kan Eriksson @erikxxon","author_name":"HĂ„kan Eriksson @erikxxon","author_icon":"//orebrotribune.com/user_avatar/orebrotribune.com/erikxxon/45/3_1.png","color":"#25628E","text":"VĂ€lkommen till Örebro Tribune punkt org - dom större och viktigare ögonblicken i tidningens liv. Det Ă€r hĂ€r jobbet hĂ€nder! \nVi vill hĂ€lsa dig som anvĂ€ndare och lĂ€sare till tidningen Örebro Tribune – Utryckning.se vĂ€lkommen in till vĂ„rt system för direktchatt -kontakt Team Chatter. Kontakten görs via chattkanaler dĂ€r du i realtid konverserar med redaktionen och andra registrerade medlemmar inne i k...","title":"Team Chatter kan du i realtid chatta med oss vid redaktionen [Örebro Tribune] örebrotribune, chatt, organisation","title_link":"http://orebrotribune.com/t/team-chatter-kan-du-i-realtid-chatta-med-oss-vid-redaktionen/61/1"}]}]
response_code	500
response_body	[{"id":"api.post.create_webhook_post.creating.app_error","message":"Error creating post","detailed_error":"","request_id":"4cwgqddxp3nbj8ngmtju4615sc","status_code":500}, {"id":"api.post.create_webhook_post.creating.app_error","message":"Error creating post","detailed_error":"","request_id":"uzruq1a7ep8udjo47mrwmzaaxa","status_code":500}, {"id":"api.post.create_webhook_post.creating.app_error","message":"Error creating post","detailed_error":"","request_id":"tsufqba5e38uzfb7qfb5754hew","status_code":500}]

(David Taylor) #4

It’s difficult to know what’s going on here. No API should ever really return an error 500 (server error), so I think it could be an issue on the mattermost end.

Maybe try asking their support team - the request & response payloads are in the ENV tab you just pasted?


(HĂ„kan Eriksson) #5

Thanks David - Ill ask them, they did released a new update a couple of days ago, may be something after that update.

Install this yesterday, and som of the post works fine but not the newest forumpost.


(David Taylor) #6

Interesting, I wonder if it could be down to Mattermost being unable to handle certain special characters through the API. The “SQL” error you posted originally could be be caused by an encoding issue
 maybe ¯\_(ツ)_/¯


(HĂ„kan Eriksson) #7

I’ve had a month ago since this installed and it worked great. Now that I installed this again I get this error.

We will see what they are responding to when they see logs :grinning:


(HĂ„kan Eriksson) #8

It seems to be my Mattermost server that caused the problem. I reinstalled the server and it works great! :flushed: