Virtomize/mail2most

A possibility to view the HTTP request sent to mattermost api

aseques opened this issue · 6 comments

I am currently trying to debug an issue where mail2most doesn't create the message in mattermost and getting a 400 error from mattermost ("Invalid or missing email parameter in request URL.")

Describe the solution you'd like
If there was a way to enable the printing of the full request being done via http to mattermost I could check their api and locate the exact issue (maybe a missing parameter or similar)

Describe alternatives you've considered
When enabling Loglevel = "debug" in mail2most.conf, the https requests should be printed.

hello @aseques can you add some log information? Are you trying to send to a secific user via email address? Make sure the emails is correct and exists in mattermost, as an alternative you can also use the username instead of email.

Sure,

The log I can see when enabling debug:

{"level":"error","ts":1597927796.412619,"caller":"mlog/log.go:175","msg":"Invalid or missing email parameter in request URL.","path":"/api/v4/users/email/siau","request_id":"y7yx9kp4aiy8zcjim8bhnnpgce","ip_addr":"::1","user_id":"zqhxrxwphtf88xc9tbbtj9kw8c","method":"GET","err_where":"Context","http_code":400,"err_details":""}

The other messages are:

time="2020-08-21T10:46:46Z" level=info msg="unseen mails" ids="[2 3]"
time="2020-08-21T10:46:46Z" level=info msg="found mail" subject="Prova mattermost 3" uid=2
time="2020-08-21T10:46:46Z" level=info msg="found mail" subject="Prova de correu" uid=3
time="2020-08-21T10:46:47Z" level=error msg="Mattermost Error" Error=": Invalid or missing email parameter in request URL., "
time="2020-08-21T10:46:47Z" level=error msg="Mattermost Error" Error=": Invalid or missing email parameter in request URL., "

And the (redacted) relevant parts of the configuration
example.txt

@aseques u want to send to the user siau, does the username in your config contains an @? If yes please remove the @ since mail2most checks if the username is an email address. Or use the email address configured in mattermost instead of the username.

Thanks for your help @c-seeger, there was no @ in the Username variable in config. After changing it to full email, it started working.
Still, if there was a way to view the full http request it would be super helpful to diagnose this issues.

Since mail2most uses the default mattermost-server/model i don't have direct access to the actuall http request generated for calling the API. I did not find a simple way to add request debug information for mattermost communication yet.

Oh, I tought it would be simpler, thanks anyway for your help, you software is great