How do fix "console.CRITICAL: Error thrown while running command "messenger:consume email". Message: "You cannot receive messages from the Messenger SyncTransport."?

Your software
My Mautic version is: 5.0.4
My PHP version is: 8.1.27
My Database type and version is: 10.6.16-MariaDB-0ubuntu0.22.04.1

Your problem
My problem is:
This keeps appearing in my log:
console.CRITICAL: Error thrown while running command “messenger:consume email”. Message: "You cannot receive messages from the Messenger SyncTransport.

How do I fix it?

These errors are showing in the log:
console.CRITICAL: Error thrown while running command “messenger:consume email”. Message: "You cannot receive messages from the Messenger SyncTransport.

Steps I have tried to fix the problem:

Anyone? I need to run that cron job. I just don’t want Mautic to try to use the Messenger SyncTransport since I only use email.

This maybe will help (seems a duplicate of it):

1 Like

Thanks! I’ll have a look!

In other words, I don’t need to run this command (messenger:consume email) during cron unless I use a sync transport. Correct?

Might be good to mention it in the installation docs.

Alternately, not log this error all the time or make the error more helpful (“this is typically caused by there not being a queue transport installed, either remove the messenger:consume email command from your crontab or set up a sync transport”)

Please feel free to make a contribution to the docs to add this note! I’m sure it would be helpful :slight_smile:

Hey, I’m having a similar trouble here.

I had a perfectly running Mautic5.0.4 instance on top of Docker but my server collapsed so I had to set it up all over again :frowning:

Anyway, I got it all working fine except for the sending of emails.

If I try my configuration individually (via s/config/edit) it works fine but I can’t get it to send scheduled emails…

The error I see is:

console.CRITICAL: Error thrown while running command “messenger:consume email”. Message: "You cannot receive messages from the Messenger SyncTransport.

I have installed symfony/google-mailer (I use Gmail for sending) and setup a Doctrine queue… what am I missing??

Thanks!

I’m going to continue the discussion started in this thread here since it is more about Docker stuff than the guide developed by @rcarabelli .

My latest discovery is that, from the three docker containers I have (web, worker and cron), the only one that actually interacts with Gmail (a.k.a. does send emails) is web. The other two will simply silently eat the messages but fail to do anything useful with them.

I fail to see the difference between them. The env variables are the same, the config file (local.php) is too…

I finally got some, hopefully, useful information from the logs in the cron container:

2024-08-15T06:18:09.637464+00:00] messenger.CRITICAL: Error thrown while handling message Symfony\Component\Mailer\Messenger\SendEmailMessage. Removing from transport after 3 retries. Error: "Handling "Symfony\Component\Mailer\Messenger\SendEmailMessage" failed: Unknown DSN scheme. Please make sure the mailer DSN is configured properly." {"class":"Symfony\\Component\\Mailer\\Messenger\\SendEmailMessage","retryCount":3,"error":"Handling \"Symfony\\Component\\Mailer\\Messenger\\SendEmailMessage\" failed: Unknown DSN scheme. Please make sure the mailer DSN is configured properly.","exception":"[object] (Symfony\\Component\\Messenger\\Exception\\HandlerFailedException(code: 0): Handling \"Symfony\\Component\\Mailer\\Messenger\\SendEmailMessage\" failed: Unknown DSN scheme. Please make sure the mailer DSN is configured properly. at /var/www/html/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php:130)\n[previous exception] [object] (Symfony\\Component\\Mailer\\Exception\\TransportException(code: 0): Unknown DSN scheme. Please make sure the mailer DSN is configured properly. at /var/www/html/docroot/app/bundles/EmailBundle/Mailer/Transport/InvalidTransport.php:17)"} {"hostname":"17746aebd88f","pid":128}

Edit

Ok, I think I got it now.

I run this command inside the cron container: composer show symfony/google-mailer and got this:

Package "symfony/google-mailer" not found, try using --available (-a) to show all available packages.

Which is different from what I got when running the same on the web container (The one that was working).

Then I remembered I did composer require symfony/google-mailer inside the web container earlier. I assumed the vendor directory would be common to every container but apparently that’s not the case. I’ll have to update my docker-compose.yml to make it so.

Now I’m waiting for the cron to do its magic to confirm everything is in place.

Edit2:

It worked :slight_smile: . I just had to issue an extra cache:clear after installing the mailer package and now the cronjobs are working and sending emails.

I guess my next step will be to put together a Docker image of my own, based on the standard mautic/mautic:5.0.4-fpm and call it a night.

1 Like