{"action":"created","issue":{"url":"https://api.github.com/repos/mattermost/platform/issues/4672","repository_url":"https://api.github.com/repos/mattermost/platform","labels_url":"https://api.github.com/repos/mattermost/platform/issues/4672/labels{/name}","comments_url":"https://api.github.com/repos/mattermost/platform/issues/4672/comments","events_url":"https://api.github.com/repos/mattermost/platform/issues/4672/events","html_url":"https://github.com/mattermost/platform/issues/4672","id":192317420,"number":4672,"title":"Replies to integrations fail in 3.5","user":{"login":"hjc1710","id":1062500,"avatar_url":"https://avatars.githubusercontent.com/u/1062500?v=3","gravatar_id":"","url":"https://api.github.com/users/hjc1710","html_url":"https://github.com/hjc1710","followers_url":"https://api.github.com/users/hjc1710/followers","following_url":"https://api.github.com/users/hjc1710/following{/other_user}","gists_url":"https://api.github.com/users/hjc1710/gists{/gist_id}","starred_url":"https://api.github.com/users/hjc1710/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjc1710/subscriptions","organizations_url":"https://api.github.com/users/hjc1710/orgs","repos_url":"https://api.github.com/users/hjc1710/repos","events_url":"https://api.github.com/users/hjc1710/events{/privacy}","received_events_url":"https://api.github.com/users/hjc1710/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-29T15:44:34Z","updated_at":"2016-12-07T05:12:34Z","closed_at":"2016-12-07T05:12:34Z","body":"#### Summary\r\n\r\nAfter 3.5, replies made to messages created by integrations (such as the wonderful [Jenkins integration](https://github.com/jenkinsci/mattermost-plugin)) do not appear work. They make it to the channel, but for the posting user it appears they failed.\r\n\r\n#### Steps to reproduce\r\n\r\n1. Install an integration such as the Jenkins or GitHub one.\r\n2. Get it to post into the channel.\r\n3. Reply to the message made by the integration and you should see a \"Retry\" and \"Cancel\" link, as if the message failed.\r\n    * Sometimes it actually works, but it seems to fail more often when doing this in a Favorited channel.\r\n4. Press \"Reply\". You will notice it instantly reappears.\r\n5. Refresh the page, you will see your original message and a duplicate made by pressing \"Retry\".\r\n\r\n#### Expected behavior\r\n\r\nMessages made in reply to integrations should complete on the first attempt and should not erroneously ask me to Retry them.\r\n\r\n#### Observed behavior\r\n\r\nAfter 3.5, any reply you make to a message made by an integration does not properly finish. Instead of seeing the message complete and post, it does not appear in your chat history and you are given the option to \"Retry\" or \"Cancel\". For other users, it will show this message. Refreshing the page will show this message. Unfortunately, pressing \"Retry\" will repost the message, which will appear to fail in the same fashion for the posting user, but will make it to the channel.\r\n\r\nThe end result is people press \"Retry\" over and over again and you get:\r\n\r\n![screenshot from 2016-11-18 16 43 41](https://cloud.githubusercontent.com/assets/1062500/20716235/8f6b3120-b61f-11e6-8b20-0b96ec93ae1a.png)\r\n\r\n#### Possible fixes\r\n\r\nI'm not familiar enough with the codebase to find an error, but I can tell you that we are hitting this route: `api/v3/teams/nrj1egj3jjro8mg99gcn1z5xce/channels/1hz79jjo1bfo5fp6j8j4gg93ty/posts/create` with this payload:\r\n\r\n```json\r\n{\r\n    \"file_ids\": [],\r\n    \"message\": \"FAIL IT BABY!\",\r\n    \"channel_id\": \"1hz79jjo1bfo5fp6j8j4gg93ty\",\r\n    \"root_id\": \"n9ien84mwf88mdanauzqjy41co\",\r\n    \"parent_id\": \"n9ien84mwf88mdanauzqjy41co\",\r\n    \"pending_post_id\": \"of36ddrjipnx58q4trs9tip1no:1480434127233\",\r\n    \"user_id\": \"of36ddrjipnx58q4trs9tip1no\",\r\n    \"create_at\": 1480434127233\r\n}\r\n```\r\n\r\nAnd we don't get ANY content back in the response, only a 500.\r\n\r\nIf I go into the server and look at docker logs, here's your stack trace:\r\n\r\n```\r\n2016/11/29 15:44:12 runtime error: invalid memory address or nil pointer dereference\r\ngoroutine 92309 [running]:\r\nruntime/debug.Stack(0x7aacec, 0xc420010190, 0x2)\r\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x79\r\nruntime/debug.PrintStack()\r\n\t/usr/local/go/src/runtime/debug/stack.go:16 +0x22\r\ngithub.com/mattermost/platform/vendor/github.com/gorilla/handlers.recoveryHandler.log(0xfc45c0, 0xc420130b60, 0x0, 0xc4217be001, 0xb92a00, 0xc420012060)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/vendor/github.com/gorilla/handlers/recovery.go:84 +0x9b\r\ngithub.com/mattermost/platform/vendor/github.com/gorilla/handlers.recoveryHandler.ServeHTTP.func1(0xfcbe80, 0xc420b148f0, 0xfc45c0, 0xc420130b60, 0x0, 0x918d01)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/vendor/github.com/gorilla/handlers/recovery.go:69 +0xae\r\npanic(0xb92a00, 0xc420012060)\r\n\t/usr/local/go/src/runtime/panic.go:458 +0x243\r\ngithub.com/mattermost/platform/api.sendNotifications(0xc420c16d80, 0xc42175bc20, 0xc420f09040, 0xc420893b80, 0xc4214975a0, 0x43d2fa, 0xcd39e0)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/api/post.go:587 +0x4d6\r\ngithub.com/mattermost/platform/api.handlePostEvents(0xc420c16d80, 0xc42175bc20, 0xc421497701)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/api/post.go:253 +0x267\r\ngithub.com/mattermost/platform/api.CreatePost(0xc420c16d80, 0xc42175bc20, 0xc421497901, 0xc42098cbd0, 0xc421642401)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/api/post.go:157 +0x3b0\r\ngithub.com/mattermost/platform/api.createPost(0xc420c16d80, 0xfcbe80, 0xc420b148f0, 0xc42175bb30)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/api/post.go:84 +0x3f4\r\ngithub.com/mattermost/platform/api.handler.ServeHTTP(0xcd19e8, 0x1010001, 0xfcbe80, 0xc420b148f0, 0xc42175bb30)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/api/context.go:213 +0xa12\r\ngithub.com/mattermost/platform/api.(*handler).ServeHTTP(0xc420684660, 0xfcbe80, 0xc420b148f0, 0xc42175bb30)\r\n\t<autogenerated>:1 +0x70\r\ngithub.com/mattermost/platform/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc4205b75e0, 0xfcbe80, 0xc420b148f0, 0xc42175bb30)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/vendor/github.com/gorilla/mux/mux.go:103 +0x255\r\ngithub.com/mattermost/platform/api.(*CorsWrapper).ServeHTTP(0xc420130b60, 0xfcbe80, 0xc420b148f0, 0xc42175bb30)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/api/context.go:263 +0x164\r\ngithub.com/mattermost/platform/vendor/github.com/gorilla/handlers.recoveryHandler.ServeHTTP(0xfc45c0, 0xc420130b60, 0x0, 0xa60000c420952d01, 0xfcbe80, 0xc420b148f0, 0xc42175bb30)\r\n\t/var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/vendor/github.com/gorilla/handlers/recovery.go:73 +0xae\r\ngithub.com/mattermost/platform/vendor/github.com/gorilla/handlers.(*recoveryHandler).ServeHTTP(0xc42076fd80, 0xfcbe80, 0xc420b148f0, 0xc42175bb30)\r\n\t<autogenerated>:52 +0x8a\r\nnet/http.serverHandler.ServeHTTP(0xc4205b5e00, 0xfcbe80, 0xc420b148f0, 0xc42175bb30)\r\n\t/usr/local/go/src/net/http/server.go:2202 +0x7d\r\nnet/http.(*conn).serve(0xc420dfa100, 0xfcc800, 0xc4216423c0)\r\n\t/usr/local/go/src/net/http/server.go:1579 +0x4b7\r\ncreated by net/http.(*Server).Serve\r\n\t/usr/local/go/src/net/http/server.go:2293 +0x44d\r\n```"},"comment":{"url":"https://api.github.com/repos/mattermost/platform/issues/comments/265357657","html_url":"https://github.com/mattermost/platform/issues/4672#issuecomment-265357657","issue_url":"https://api.github.com/repos/mattermost/platform/issues/4672","id":265357657,"user":{"login":"jasonblais","id":13119842,"avatar_url":"https://avatars.githubusercontent.com/u/13119842?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonblais","html_url":"https://github.com/jasonblais","followers_url":"https://api.github.com/users/jasonblais/followers","following_url":"https://api.github.com/users/jasonblais/following{/other_user}","gists_url":"https://api.github.com/users/jasonblais/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonblais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonblais/subscriptions","organizations_url":"https://api.github.com/users/jasonblais/orgs","repos_url":"https://api.github.com/users/jasonblais/repos","events_url":"https://api.github.com/users/jasonblais/events{/privacy}","received_events_url":"https://api.github.com/users/jasonblais/received_events","type":"User","site_admin":false},"created_at":"2016-12-07T05:12:34Z","updated_at":"2016-12-07T05:12:34Z","body":"Thanks again @hjc1710 for the report! Really loved the detail here and it helped with reproducing the issue.\r\n\r\nI'll close this and we can track the issue in Jira: https://mattermost.atlassian.net/browse/PLT-4906"}}
{"actor":{"display_login":"jasonblais"}}