For arlanix/notification 1.0.1
Troubleshooting
The module writes its log to var/log/arlanix.log, under the channel arlanix_notification. For the store owner's side of each problem, see the manual's troubleshooting.
setup:upgrade fails on RabbitMQ
setup:upgrade, or setup:db-schema:upgrade during a deploy, stops in Magento_Amqp's setup with this error:
Error while checking if topic "arlanix.notification.deliver" is synchronous
The store's cache still holds the list of message queue topics from before the modules were installed. Magento reads the queues to declare on RabbitMQ from the new code. So it finds a queue for a topic it does not know. This happens when the cache outlives the code, for example a Redis cache that the running site shares during a deploy.
To fix it, clean the config cache and run the upgrade again:
bin/magento cache:clean config
bin/magento setup:upgrade
In a deploy, clean the config cache just before setup:db-schema:upgrade. Then the upgrade reads the new release's configuration from start to end. With Deployer's Magento recipe, add this task:
task('magento:upgrade:db:clean_config', function () {
if (get('database_upgrade_needed')) {
run('{{bin/php}} {{bin/magento}} cache:clean config');
}
});
before('magento:upgrade:db', 'magento:upgrade:db:clean_config');
This happens on such a deploy with any module that adds a queue topic, not only with these modules.
Deliveries wait on the queue
The admin shows this message:
Arlanix Notifications: 3 notification(s) have waited more than 15 minutes to be sent. Nothing takes them off the message queue: start the consumer with bin/magento queue:consumers:start arlanix_notification_deliver, or check that cron runs the queue consumers (cron_consumers_runner) and the arlanix_notification cron group.
Check that the consumer exists, and run it by hand:
bin/magento queue:consumers:list | grep arlanix bin/magento queue:consumers:start arlanix_notification_deliver --max-messages=100If the second command sends the deliveries, cron does not start the consumer. There are two possible reasons:
Cron itself does not run. It must run
bin/magento cron:runevery minute.app/etc/env.phpstops the consumer runner. Allow it to run:'cron_consumers_runner' => [ 'cron_run' => true, ],If
app/etc/env.phphas nocron_consumers_runnerat all, the runner also runs. Ifcron_consumers_runnerhas aconsumerslist, the runner starts only the consumers in that list. Addarlanix_notification_deliverto it. Magento readsapp/etc/env.phpon every run, so the next minute's cron starts the consumer.
By default,
queue/only_spawn_when_message_availableis1. The runner then starts the consumer only when messages are waiting. This is all the consumer needs.On RabbitMQ, check that the queue
arlanix.notification.deliveris declared. Until it is, Magento's consumer runner fails on every run and starts none of the store's consumers. Incron_schedule, theconsumers_runnerjob shows this error:NOT_FOUND - no queue 'arlanix.notification.deliver' in vhost '/'
setup:upgradedeclares the queue. Some deploys run it only whensetup:db:statusreports that the database is behind, as Deployer's Magento recipe does. Such a deploy skips it after an earlier deploy failed after the schema step. It also never notices a RabbitMQ server that lost its queues. To declare the queue whatever the status, run:bin/magento setup:db-schema:upgradeA deploy can declare the queues on every run by calling
Magento\Framework\Amqp\TopologyInstaller::install(), as Magento_Amqp's setup does. Declaring a queue that already exists changes nothing.Deliveries published while the queue was missing were lost on the way. The cron puts them back on the queue one hour after they were published.
If a delivery stays in retry after its time has passed, the arlanix_notification cron group does not run. To run it by hand, use this command:
bin/magento cron:run --group=arlanix_notification
A delivery failed
The message's page in the Message Log and the subscription's Last delivery show what the server answered.
These are the email errors:
| Message | Meaning |
|---|---|
| Magento's email is switched off: … | system/smtp/disable is on, and Send through is Magento's mail. |
| Magento could not send the email: … | Magento's mail transport failed. The reason follows in the message. Magento logs it too. On 2.4.8 and later, a mail server's refusal goes to var/log/system.log as Transport error while sending email: …. Other errors go to var/log/exception.log. |
| Enter the sender email: … | smtp/from_email is empty. Through Magento's mail, the General Contact email is also empty. |
| The SMTP server is not set up yet: … | Send through is an SMTP server of its own, and smtp/host is empty. |
| The sender address "…" is not an email address | smtp/from_email is not a valid email address. |
| The SMTP server host:port did not take the email: Connection could not be established … | The host or port is wrong, or DNS or a firewall blocks the connection. To test it, run nc -vz host port on the web server. |
| … Expected response code "235" but got code "535" … | The username or password is wrong. |
| … Expected response code "250" but got code "550" … | The server refuses the sender. Often the account may not send as that address. With "250/251/252", the server refuses the recipient. |
| … does not offer STARTTLS, so nothing was sent | Choose SSL/TLS, or None for a local relay. |
| Something went wrong. Check the log for details. | An unexpected error. The stack trace is in var/log/arlanix.log. |
These are the Telegram, Slack and Discord errors:
| Message | Meaning |
|---|---|
| No answer from api.telegram.org: …, … hooks.slack.com …, … discord.com … | The store cannot reach the service. DNS, a firewall or an outgoing proxy blocks it. To test it, run curl -sI https://api.telegram.org on the web server. |
| The Telegram bot is not set up yet: … | telegram/bot_token is empty, and the subscription has no bot of its own. |
| Telegram answered: Unauthorized. … | The bot token is wrong. The message says whether it is the store's token or the subscription's. |
| Telegram answered: … | Telegram's own error, with what to do. See the manual. |
| Slack answered: no_service. … and others | Slack's own error, with what to do. See the manual. |
| Discord answered: Unknown Webhook. … and others | Discord's own error, with what to do. See the manual. |
| Telegram asked to wait … second(s): …, and the same from Slack and Discord | The service answered HTTP 429. The deliveries wait as long as the service asked, at most one hour, or one minute when it gave no time. Then the cron puts them back on the queue. During the first day after the message was published, this wait does not use up an attempt. Common causes are many subscriptions to one chat, or a burst of digests. |
After you fix the cause, click Retry now on the message's page. The failed deliveries go back on the queue at once, and their attempts start over.
A message has no deliveries
The Message Log shows No subscribers when the topic has no active subscription that takes the message's severity.
A topic that is switched off logs nothing in the Message Log. The module drops the message and writes an info line to its log. You see that line only when Stores > Configuration > Arlanix > Logging > Log level is Info or Debug.
If the topic id does not exist, the module logs a warning that names the message and its source.
A digest was not formed
Messages merge only within one batch. Under the cron runner, a batch is the messages that waited when the minute's run began. A consumer that keeps running reads a batch every 10 seconds. With several consumers, each one merges only its own batch. A digest holds up to 25 different messages (DigestBuilder::MAX_ENTRIES). If a subscription's batch has more, it goes as several digests.
A rule does not send
Check these points in order:
- The rule and its topic are active, and the topic has a subscription that takes the rule's severity. Otherwise the Message Log shows No subscribers.
- The event is emitted at all. The rule form does not offer an event of a module that is not enabled, such as Magento_Review's. Sales events are emitted after the transaction commits, so a test that rolls back its transaction emits nothing.
- The conditions match the data that was emitted. Preview uses the event's declared sample data, not real data. To see the real data, log it in a test, or loosen a condition and see whether the rule sends.
- The rule's subject and body name fields the event has. When you save a rule, a template that names a field the event does not have is refused. A field that is empty renders as empty, or as the text of its
default:modifier.
A rule's message is published like any other message. The queue, the consumer and the retries described above all apply to it.