Enabling email notifications caues mattermost not to start


#1

I get the below error when I set SendEmailNotifications to true, if I set it to false everything works fine. I can even re-enable it in the web interface and send test emails, but if I restart mattermost it fails unless I manually reset it to false.

Mail Config
"EmailSettings": {
“EnableSignUpWithEmail”: true,
“EnableSignInWithEmail”: true,
“EnableSignInWithUsername”: true,
“SendEmailNotifications”: true,
“RequireEmailVerification”: false,
“FeedbackName”: “Coconuts”,
“FeedbackEmail”: "donotreply@no.com",
“SMTPUsername”: "email@email.com",
“SMTPPassword”: “password”,
“SMTPServer”: “smtp.gmail.com”,
“SMTPPort”: “587”,
“ConnectionSecurity”: “TLS”,
“InviteSalt”: “bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS”,
“PasswordResetSalt”: “vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL”,
“SendPushNotifications”: false,
“PushNotificationServer”: “”,
“PushNotificationContents”: “generic”
},

error:

root@mattermost:/home/mattermost/mattermost/bin# ./platform -config=/home/mattermost/mattermost/config/config.json
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: interface conversion: interface is runtime.errorString, not string
[signal 0xb code=0x1 addr=0x0 pc=0x780b9d]

goroutine 1 [running]:
panic(0xcd1aa0, 0xc82012cc40)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
main.doLoadConfig.func1(0xc820251d38)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/mattermost.go:73 +0x6f
panic(0xccbec0, 0xc82000e0c0)
/usr/local/go/src/runtime/panic.go:443 +0x4e9
github.com/mattermost/platform/utils.TestConnection(0xc82007cb00)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/utils/mail.go:89 +0x32d
github.com/mattermost/platform/utils.LoadConfig(0x7ffd77bd38da, 0x2e)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/utils/config.go:181 +0x10aa
main.doLoadConfig(0x7ffd77bd38da, 0x2e, 0x0, 0x0)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/mattermost.go:76 +0x6a
main.main()
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/mattermost.go:84 +0x43


#2

Try validating your config.json in http://jsonlint.com/. There’s a bug in 3.1 outputting cryptic error messages. Most of the time it’s a typo in config.json.


#3

I get Valid JSON.
After the initial setup, I did not edit the config directly until I ran into this issue.


#4

Could you try setting it to the version that works, starting the server, then updating via System Console > Notifications > Email and saving the file?

This would rule out typos in the config.json


#5

I have multiple times with no success

I did notice that it incorrectly set the setting once. I had initially put 465 as the port, but when I check the file it was set to 4 and the username and password were blank


#6

Thanks for the report @vorgusa There was a bug where an invalid json field in the config file or a failed connection with EmailSettings may cause this error. It’s fixed on master and will be in for the next release.

In the meantime, you may try the following steps as a workaround:

  1. Stop the server
  2. Remove EmailSettings from your config.json
  3. Start the server
  4. From the System Console re-add the Email Settings

#7

Validate your config.json file at json formatter

  1. Stop the server
  2. Remove EmailSettings from your config.json
  3. Start the server
  4. From the System Console re-add the Email Settings