statping-ng / statping-ng

An updated drop-in for statping. A Status Page for monitoring your websites and applications with beautiful graphs, analytics, and plugins. Run on any type of environment.
https://statping-ng.github.io
GNU General Public License v3.0
1.46k stars 149 forks source link

Disabling TLS/SSL for the SMTP Mail Notifier does not work #68

Open danielvion opened 2 years ago

danielvion commented 2 years ago

I have deployed a container using the latest statping-ng image available.

Disabling the TLS/SSL for the SMTP notifier just hang loading.

In the browser console I get the following error message:

Failed to load resource: the server responded with a status of 422 (Unprocessable Entity)

Error: Request failed with status code 422
    at t.exports (vendor.chunk.js:23)
    at t.exports (vendor.chunk.js:48)
    at XMLHttpRequest.d.onreadystatechange (vendor.chunk.js:23)
$t @ vendor.chunk.js:7

The server outputs the following error message: ERRO[0114] sending error response for /api/notifier/email: could not decode incoming JSON code=422 device="map[arch:amd64 num_cpu:8]" method=POST os="map[name:linux]" runtime="map[go_maxprocs:8 go_numcgocalls:1 go_numroutines:15 name:go version:go1.14.15]" type=handlers url=/api/notifier/email

The bug can also be reproduced locally. Just starting the container and trying to disable the TLS for the notifier doesn't work.

adamboutcher commented 2 years ago

We'll take a look when we can. We might need more details when we get round to it.

danielvion commented 2 years ago

I will try my best to supply you with the needed information.

mannharleen commented 2 years ago

Not working for me as well. As soon as I disable SSL/TLS, I get the following error -

ERRO[6930] sending error response for /api/notifier/email: could not decode incoming JSON  code=422 method=POST type=handlers url=/api/notifier/email

@danielvion your error msg has some extra information. did you enable some debug logs? how?

danielvion commented 2 years ago

It looks like the server logs are identical. I also posted the browser console error message, if that's what you mean.

3-w-c commented 2 years ago

I see the same behaviour.

Successful POST (Disable SSl/TLS verify is disabled):

{"enabled":false,"limits":30,"method":"email","host":"smtp_hostname","username":"","password":"","port":25,"var1":"email@example.com","var2":"email2@example.com","api_key":"","success_data":null,"failure_data":null}

Failing request with "Disable SSL/TLS":

{"enabled":false,"limits":30,"method":"email","host":"smtp_hostname","username":"","password":"","port":25,"var1":"email2@example.com","var2":"email2@example.com","api_key":true,"success_data":null,"failure_data":null}

The only difference seems to be api_key: true vs api_key: null?

adamboutcher commented 2 years ago

Something wrong here https://github.com/statping-ng/statping-ng/blob/f5e837c1fc1cab969393ee0db527de2e41a48d47/notifiers/email.go#L158