mastodon / mastodon

Your self-hosted, globally interconnected microblogging community
https://joinmastodon.org
GNU Affero General Public License v3.0
47.22k stars 7k forks source link

SMTP Auth Error message prematurely truncated on first newline #32343

Open alsutton opened 1 month ago

alsutton commented 1 month ago

Steps to reproduce the problem

  1. Configure invalid auth parameters for your SMTP Server
  2. Try to send a new-follower email
  3. See the error in the logs ...

Expected behaviour

Full error reported

Actual behaviour

Only the first line of the error

Detailed description

Running through journalctl -u mastodon-sidekiq to try and diagnose an SMTP sending failure issue I came across multiple copies of lines like there where the useful information has been missed because the error stretches over more than one line;

Oct 09 06:35:53 ip-172-30-2-31 bundle[41086]: 2024-10-09T06:35:53.380Z pid=41086 tid=1tre WARN: {"context":"Job raised exception","job":{"retry":true,"queue":"mailers","class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ActionMailer::MailDeliveryJob","args":[{"job_class":"ActionMailer::MailDeliveryJob","job_id":"191c38d9-da61-47b6-a905-dc8a4eee5b3d","provider_job_id":null,"queue_name":"mailers","priority":null,"arguments":["NotificationMailer","follow","deliver_now",{"params":{"recipient":{"_aj_globalid":"gid://mastodon/Account/109280928124762359"},"notification":{"_aj_globalid":"gid://mastodon/Notification/21398"},"_aj_symbol_keys":["recipient","notification"]},"args":[],"_aj_ruby2_keywords":["params","args"]}],"executions":0,"exception_executions":{},"locale":"en","timezone":"UTC","enqueued_at":"2024-09-20T18:24:01Z"}],"jid":"787c398a5eb9b5a2ed5ccb1a","created_at":1726856641.5895948,"enqueued_at":1728455753.3241372,"error_message":"535-5.7.8 Username and Password not accepted. For more information, go to\n","error_class":"Net::SMTPAuthenticationError","failed_at":1726856764.8277164,"retry_count":23,"retried_at":1728289969.2589202}}

In this case the error message reads Username and Password not accepted. For more information, go to\n which means the URL is lost.

Mastodon instance

snapp.social

Mastodon version

v4.3.0

Technical details

If this is happening on your own Mastodon server, please fill out those:

alsutton commented 1 month ago

It'd be great to see https://github.com/mastodon/mastodon/issues/7323 addressed so that I don't need to trawl through sidekiq logs to get any error message.