Error 500 in Gitlab with Mattermost when creating group
### Summary
Running Gitlab 9.3.4 with Mattermost. When creating a new group in Gitlab with "Create a Mattermost team for this group" selected, I get an error 500.
### Steps to reproduce
Configure Mattermost with Gitlab omnibus. Login to Gitlab. Login to Mattermost in second tab (SSO ok). Go to the Gitlab tab. Create a group with "Create a Mattermost team for this group".
### What is the current *bug* behavior?
Error 500 displayed.
### What is the expected *correct* behavior?
Group created. When "Create a Mattermost team for this group" is unchecked, group is created ok.
### Relevant logs and/or screenshots
```
/var/log/gitlab/gitlab-rails:
Processing by GroupsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ljucazmNCdTF5PsgzCLAVDSe4QKDPalZBVs4UugvGCjnhocZneE+TdSHMAQKw60DGou/S9Iztx1CQEE6P/0HA==", "group"=>{"path"=>"test123", "name"=>"test123", "description"=>"", "visibility_level"=>"0", "create_chat_team"=>"true"}}
Completed 500 Internal Server Error in 31ms (ActiveRecord: 2.2ms)
Mattermost::NoSessionError (No session could be set up, is Mattermost configured with Single Sign On?):
lib/mattermost/session.rb:39:in `block in with_session'
lib/mattermost/session.rb:137:in `with_lease'
lib/mattermost/session.rb:38:in `with_session'
lib/mattermost/client.rb:12:in `with_session'
lib/mattermost/client.rb:34:in `session_post'
lib/mattermost/team.rb:11:in `create'
app/services/mattermost/create_team_service.rb:9:in `execute'
app/services/groups/create_service.rb:26:in `execute'
app/controllers/groups_controller.rb:32:in `create'
lib/gitlab/i18n.rb:39:in `with_locale'
lib/gitlab/i18n.rb:45:in `with_user_locale'
app/controllers/application_controller.rb:303:in `set_locale'
lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb:16:in `call'
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/request_context.rb:18:in `call'
```
Relevant config of Mattermost in /etc/gitlab/gitlab.rb:
```
mattermost_external_url 'http://mattermost.mysite.com'
mattermost['service_address'] = "10.10.10.20"
mattermost['service_site_url'] = "https://mattermost.mysite.com"
mattermost['team_site_name'] = "My Site"
mattermost['gitlab_auth_endpoint'] = "https://gitlab.mysite.com/oauth/authorize"
mattermost['gitlab_token_endpoint'] = "https://gitlab.mysite.com/oauth/token"
mattermost['gitlab_user_api_endpoint'] = "https://gitlab.mysite.com/api/v3/user"
mattermost['email_enable_sign_up_with_email'] = false
mattermost['email_enable_sign_in_with_email'] = false
mattermost['email_enable_sign_in_with_username'] = false
mattermost['email_send_email_notifications'] = true
mattermost['email_require_email_verification'] = false
mattermost['email_smtp_server'] = "mail.mysite.com"
mattermost['email_smtp_port'] = "25"
mattermost['email_feedback_name'] = "My Site"
mattermost['email_feedback_email'] = "ne-pas-repondre@mysite.com"
mattermost['file_max_file_size'] = 2097152
mattermost['support_terms_of_service_link'] = ""
mattermost['support_privacy_policy_link'] = ""
mattermost['support_about_link'] = ""
mattermost['support_report_a_problem_link'] = ""
mattermost['support_email'] = "admin@mysite.com"
mattermost['localization_server_locale'] = "fr"
mattermost['localization_client_locale'] = "fr"
mattermost['localization_available_locales'] = "fr"
```
### Output of checks
#### Results of GitLab environment info
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
System information
System: Ubuntu 16.04
Current User: git
Using RVM: no
Ruby Version: 2.3.3p222
Gem Version: 2.6.6
Bundler Version:1.13.7
Rake Version: 10.5.0
Redis Version: 3.2.5
Git Version: 2.13.0
Sidekiq Version:5.0.0
Go Version: unknown
GitLab information
Version: 9.3.4
Revision: 3888c01
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: https://gitlab.mysite.com
HTTP Clone URL: https://gitlab.mysite.com/some-group/some-project.git
SSH Clone URL: git@gitlab.mysite.com:some-group/some-project.git
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 5.1.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git
</pre>
</details>
#### Results of GitLab application Check
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
Checking GitLab Shell ...
GitLab Shell version >= 5.1.1 ? ... OK (5.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
39/13 ... ok
3/14 ... ok
4/15 ... ok
5/18 ... ok
28/27 ... ok
41/28 ... ok
41/30 ... ok
3/32 ... ok
3/33 ... ok
46/37 ... ok
13/38 ... ok
53/39 ... ok
48/41 ... repository is empty
4/42 ... ok
56/43 ... ok
3/45 ... ok
3/46 ... ok
3/48 ... ok
3/50 ... ok
29/52 ... ok
3/55 ... ok
13/56 ... ok
3/57 ... ok
78/58 ... ok
4/61 ... ok
41/64 ... ok
28/66 ... ok
3/69 ... ok
5/70 ... ok
5/71 ... ok
82/72 ... repository is empty
82/73 ... ok
5/74 ... ok
86/76 ... ok
86/77 ... ok
86/78 ... ok
86/79 ... ok
3/83 ... ok
89/97 ... ok
89/100 ... ok
89/102 ... ok
89/114 ... ok
89/130 ... ok
89/131 ... ok
3/133 ... ok
86/134 ... ok
92/135 ... ok
86/137 ... ok
86/138 ... ok
84/139 ... ok
93/141 ... ok
3/144 ... ok
86/145 ... ok
94/146 ... ok
89/148 ... ok
89/150 ... ok
97/151 ... repository is empty
97/152 ... ok
97/153 ... repository is empty
49/160 ... ok
49/161 ... ok
29/166 ... ok
93/168 ... ok
86/169 ... ok
3/171 ... ok
12/172 ... ok
86/173 ... ok
86/178 ... ok
58/180 ... ok
26/181 ... ok
86/184 ... ok
48/185 ... ok
112/187 ... repository is empty
43/188 ... ok
49/189 ... ok
86/190 ... ok
115/191 ... ok
86/192 ... ok
116/193 ... ok
116/194 ... ok
116/195 ... ok
13/199 ... ok
127/200 ... ok
127/201 ... ok
127/202 ... ok
127/204 ... ok
127/205 ... ok
127/206 ... ok
86/207 ... ok
86/210 ... ok
127/211 ... ok
127/212 ... ok
127/213 ... ok
127/214 ... ok
127/215 ... ok
125/216 ... ok
125/217 ... repository is empty
133/219 ... ok
134/220 ... ok
137/223 ... ok
116/225 ... ok
116/226 ... ok
116/227 ... ok
127/230 ... ok
86/231 ... ok
116/232 ... ok
127/233 ... ok
116/234 ... ok
86/235 ... ok
86/236 ... ok
92/240 ... ok
127/241 ... ok
92/243 ... ok
147/245 ... repository is empty
86/246 ... ok
86/247 ... ok
134/248 ... ok
43/249 ... ok
148/251 ... ok
148/252 ... ok
148/253 ... ok
148/254 ... ok
148/255 ... ok
148/256 ... repository is empty
148/257 ... repository is empty
139/259 ... ok
139/260 ... ok
116/261 ... ok
148/262 ... ok
148/263 ... ok
148/264 ... ok
5/265 ... ok
127/266 ... ok
137/267 ... ok
133/268 ... ok
168/269 ... ok
137/270 ... ok
155/271 ... repository is empty
156/272 ... ok
92/274 ... ok
86/276 ... ok
86/277 ... ok
158/279 ... ok
116/280 ... ok
116/282 ... ok
86/283 ... ok
86/284 ... ok
160/285 ... ok
86/287 ... ok
86/288 ... ok
86/289 ... ok
86/290 ... ok
86/291 ... ok
86/292 ... ok
86/293 ... ok
86/294 ... ok
86/295 ... ok
116/296 ... ok
86/297 ... ok
86/299 ... ok
86/300 ... ok
86/301 ... ok
86/302 ... ok
86/303 ... ok
163/305 ... ok
48/306 ... ok
86/307 ... ok
86/308 ... ok
86/309 ... ok
166/310 ... ok
86/311 ... ok
86/312 ... ok
86/313 ... ok
127/314 ... ok
127/315 ... repository is empty
86/316 ... ok
163/317 ... ok
171/323 ... ok
163/324 ... ok
86/325 ... ok
12/327 ... repository is empty
3/329 ... repository is empty
163/330 ... ok
172/332 ... ok
163/334 ... ok
149/336 ... ok
125/337 ... ok
29/338 ... ok
116/339 ... ok
163/340 ... ok
127/341 ... ok
163/343 ... ok
163/344 ... ok
177/345 ... repository is empty
86/347 ... ok
86/348 ... ok
40/349 ... repository is empty
12/350 ... ok
86/352 ... ok
178/353 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
[SANITIZED]
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ...
39/13 ... yes
3/14 ... yes
4/15 ... yes
5/18 ... yes
28/27 ... yes
41/28 ... yes
41/30 ... yes
3/32 ... yes
3/33 ... yes
46/37 ... yes
13/38 ... yes
53/39 ... yes
48/41 ... yes
4/42 ... yes
56/43 ... yes
3/45 ... yes
3/46 ... yes
3/48 ... yes
3/50 ... yes
29/52 ... yes
3/55 ... yes
13/56 ... yes
3/57 ... yes
78/58 ... yes
4/61 ... yes
41/64 ... yes
28/66 ... yes
3/69 ... yes
5/70 ... yes
5/71 ... yes
82/72 ... yes
82/73 ... yes
5/74 ... yes
86/76 ... yes
86/77 ... yes
86/78 ... yes
86/79 ... yes
3/83 ... yes
89/97 ... yes
89/100 ... yes
89/102 ... yes
89/114 ... yes
89/130 ... yes
89/131 ... yes
3/133 ... yes
86/134 ... yes
92/135 ... yes
86/137 ... yes
86/138 ... yes
84/139 ... yes
93/141 ... yes
3/144 ... yes
86/145 ... yes
94/146 ... yes
89/148 ... yes
89/150 ... yes
97/151 ... yes
97/152 ... yes
97/153 ... yes
49/160 ... yes
49/161 ... yes
29/166 ... yes
93/168 ... yes
86/169 ... yes
3/171 ... yes
12/172 ... yes
86/173 ... yes
86/178 ... yes
58/180 ... yes
26/181 ... yes
86/184 ... yes
48/185 ... yes
112/187 ... yes
43/188 ... yes
49/189 ... yes
86/190 ... yes
115/191 ... yes
86/192 ... yes
116/193 ... yes
116/194 ... yes
116/195 ... yes
13/199 ... yes
127/200 ... yes
127/201 ... yes
127/202 ... yes
127/204 ... yes
127/205 ... yes
127/206 ... yes
86/207 ... yes
86/210 ... yes
127/211 ... yes
127/212 ... yes
127/213 ... yes
127/214 ... yes
127/215 ... yes
125/216 ... yes
125/217 ... yes
133/219 ... yes
134/220 ... yes
137/223 ... yes
116/225 ... yes
116/226 ... yes
116/227 ... yes
127/230 ... yes
86/231 ... yes
116/232 ... yes
127/233 ... yes
116/234 ... yes
86/235 ... yes
86/236 ... yes
92/240 ... yes
127/241 ... yes
92/243 ... yes
147/245 ... yes
86/246 ... yes
86/247 ... yes
134/248 ... yes
43/249 ... yes
148/251 ... yes
148/252 ... yes
148/253 ... yes
148/254 ... yes
148/255 ... yes
148/256 ... yes
148/257 ... yes
139/259 ... yes
139/260 ... yes
116/261 ... yes
148/262 ... yes
148/263 ... yes
148/264 ... yes
5/265 ... yes
127/266 ... yes
137/267 ... yes
133/268 ... yes
168/269 ... yes
137/270 ... yes
155/271 ... yes
156/272 ... yes
92/274 ... yes
86/276 ... yes
86/277 ... yes
158/279 ... yes
116/280 ... yes
116/282 ... yes
86/283 ... yes
86/284 ... yes
160/285 ... yes
86/287 ... yes
86/288 ... yes
86/289 ... yes
86/290 ... yes
86/291 ... yes
86/292 ... yes
86/293 ... yes
86/294 ... yes
86/295 ... yes
116/296 ... yes
86/297 ... yes
86/299 ... yes
86/300 ... yes
86/301 ... yes
86/302 ... yes
86/303 ... yes
163/305 ... yes
48/306 ... yes
86/307 ... yes
86/308 ... yes
86/309 ... yes
166/310 ... yes
86/311 ... yes
86/312 ... yes
86/313 ... yes
127/314 ... yes
127/315 ... yes
86/316 ... yes
163/317 ... yes
171/323 ... yes
163/324 ... yes
86/325 ... yes
12/327 ... yes
3/329 ... yes
163/330 ... yes
172/332 ... yes
163/334 ... yes
149/336 ... yes
125/337 ... yes
29/338 ... yes
116/339 ... yes
163/340 ... yes
127/341 ... yes
163/343 ... yes
163/344 ... yes
177/345 ... yes
86/347 ... yes
86/348 ... yes
40/349 ... yes
12/350 ... yes
86/352 ... yes
178/353 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.3 ? ... yes (2.3.3)
Git version >= 2.7.3 ? ... yes (2.13.0)
Active users: ... 135
Checking GitLab ... Finished
</pre>
</details>
### Possible fixes
issue