Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Amqp as a dependency for ProductAlert #35790

Open
1 of 5 tasks
Bartiema opened this issue Jul 21, 2022 · 21 comments
Open
1 of 5 tasks

Add Amqp as a dependency for ProductAlert #35790

Bartiema opened this issue Jul 21, 2022 · 21 comments
Assignees
Labels
Area: Framework Component: Cron Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@Bartiema
Copy link

Bartiema commented Jul 21, 2022

Summary (*)

If the amqp module is not installed in your magento 2.4.4 instance and you want to use the ProductAlert module functionality you will never be able to send alert emails because when the cronjob catalog_product_alert is run there will be a critical error with the message: "Publisher 'product_alert' is not declared"

Steps to reproduce

  • Set a specific product to be out of stock
  • Go to frontend and subscribe to product inventory alert, so the customer gets notified as soon as the product is back in stock
  • Make sure, that the customer alert appears in the product view in the admin area in the Product Alerts section.
  • Put the product back to stock
  • To manually run this cron job from the CLI you could do this
mysql -e "INSERT INTO cron_schedule ( job_code, scheduled_at ) VALUES ( 'catalog_product_alert', CURENT_TIMESTAMP );" && php bin/magento cron:run
  • You will directly get the error message CRITICAL: Publisher 'product_alert' is not declared. [] []
  • Activate Magento_Amqp and do the same again
  • The error will be gone

Examples (*)

.CRITICAL: Publisher 'product_alert' is not declared. [] []
is the error you can find in debug.log after running bin/magento cron:run when the cronjob catalog_product_alert is trying to send an alert.

Proposed solution

Add the amqp module as a dependency for the ProductAlert module, both in composer and in the module.xml


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users with no workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@Bartiema Bartiema added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Jul 21, 2022
@m2-assistant
Copy link

m2-assistant bot commented Jul 21, 2022

Hi @Bartiema. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@engcom-Echo
Copy link
Contributor

@Bartiema

Thanks for reporting the issue.

As you mentioned that "amqp module is not installed " so, could you please confirm if you uninstalled or disabled the module "module-amqp" in config.php file then run the cron manually from terminal so you got that exception.

Please provide the exact steps to reproduce the same and share the screenshots so we can try to reproduce the same at our end.

Thanks,

@engcom-Echo engcom-Echo added the Issue: needs update Additional information is require, waiting for response label Jul 22, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jul 22, 2022
@m2-assistant
Copy link

m2-assistant bot commented Jul 29, 2022

Hi @engcom-Echo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@engcom-Echo
Copy link
Contributor

Hello @Bartiema,

We have noticed that this issue has not been updated for a period of 14 Days.
Hence we assume that this issue is fixed now, so we are closing it.Please raise a fresh ticket or reopen this ticket if you need more assistance on this.

Thanks

@norgeindian
Copy link

@engcom-Echo , I can verify the issue still persists on Magento 2.4.5-p1.
You can reproduce it, like @Bartiema said, by disabling Magento_Amqp and then doing the following steps:

  • Set a specific product to be out of stock
  • Go to frontend and subscribe to product inventory alert, so the customer gets notified as soon as the product is back in stock
  • Make sure, that the customer alert appears in the product view in the admin area in the Product Alerts section.
  • Put the product back to stock
  • Run bin/magento cron:run
  • You will directly get the error message CRITICAL: Publisher 'product_alert' is not declared. [] []
  • Activate Magento_Amqp and do the same again
  • The error will be gone

@PromInc
Copy link

PromInc commented Dec 22, 2022

I can confirm the same situation.

Never needed the amqp module in the past. But it appears with v2.4.5-p1 (or maybe one of the versions prior) it is required??? Can't find any documenation to support that, but appears to be the case if you want to send product alerts...

@APanteleychuk
Copy link

I can confirm the same situation too.

@HenKun
Copy link

HenKun commented Sep 12, 2023

@engcom-Echo This issue is closed, but reproducible on 2.4.6-p2

Other modules do not need to have Magento_Amqp enabled, like Magento_Catalog with the topic product_action_attribute.update or Magento_SalesRule with topic sales_rule.codegenerator. Both modules have files etc/queue_publisher.xml and etc/queue_topology.xml, whereas Magento_ProductAlert does not provide these files.
Might there be a problem?

@m2-assistant
Copy link

m2-assistant bot commented Sep 12, 2023

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel
Copy link
Contributor

Hello @norgeindian,

Thanks for the steps to reproduce the issue. We have followed the same but the issue is not reproducible for us.

  • We have disabled the Magento_Amqp module:
    image

  • Make Product out of stock

  • Signup for Notify me when this product is in stock

  • Make product in stock

  • Ran bin/magento cron:run
    image

The command ran successfully, it might be possible the issue is resolved in the latest 2.4-develop branch. I request you to please try to reproduce the issue in the latest development branch.

Thanks

@engcom-Hotel engcom-Hotel reopened this Sep 12, 2023
@m2-community-project m2-community-project bot removed the Issue: needs update Additional information is require, waiting for response label Sep 12, 2023
@m2-community-project m2-community-project bot added this to Ready for Confirmation in Issue Confirmation and Triage Board Sep 12, 2023
@engcom-Hotel engcom-Hotel added Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report. and removed Issue: ready for confirmation labels Sep 12, 2023
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Sep 12, 2023
@HenKun
Copy link

HenKun commented Sep 13, 2023

Note that the cron for catalog_product_alert is only scheduled once a day (depending on the settings). So not every cron:run will trigger the issue.

Furthermore, the Exception is thrown in Magento\Framework\MessageQueue\Publisher\Config::getPublisher($topic).
The class comment states: "Publisher config provides access data declared in etc/queue_publisher.xml".
And indeed, all modules having a communication.xml file, also have a queue_publisher.xml file, only ProductAlert module does not have this file. According to https://developer.adobe.com/commerce/php/development/components/message-queues/configuration/ and https://developer.adobe.com/commerce/php/development/components/message-queues/migration/:

If you only want to consume from an existing queue, you will only need the queue_consumer.xml config file.

Since product_alert.queue is not an existing queue, a etc/queue_topology.xml must be created. Since we want to publish to this queue, a etc/queue_publisher.xml must be created.

I can't tell why it works with activated Magento_Amqp. I have not tested it with activated Magento_Amqp.
But the Reader responsible for getting the publisher config is Magento\Framework\MessageQueue\Publisher\Config\CompositeReader, which, besides reading from etc/queue_publisher.xml, also tries to get config data from Magento\WebapiAsync\Code\Generator\Config\RemoteServiceReader\Publisher and Magento\Framework\MessageQueue\Publisher\Config\RemoteService\Reader. It might be that those additional readers return an auto generated config, when Magento_Amqp is enabled, and do not when it is disabled.

@HenKun
Copy link

HenKun commented Sep 28, 2023

I just can restate the steps described before:
#35790 (comment)

However when executing cron:run you have to go sure the job is actually scheduled, since this is done only once a day.

@engcom-Hotel
Copy link
Contributor

Hello @HenKun,

Thanks for the reply!

We have tried to reproduce this issue with the mentioned steps here #35790 (comment) in the 2.4-develop branch, but the issue is still not reproducible for us.

We have made changes in the setting of product alert cron from the admin panel as well. Please refer to the below screenshot for reference:

image

We request you to please try to reproduce the issue in the 2.4-develop branch.

Thanks

@HenKun
Copy link

HenKun commented Sep 29, 2023

@engcom-Hotel Was the product alert mail actually sent? So did you receive the alert email? We have to go sure the cron job is actually executed when verifying the issue. Otherwise the issue cannot occur.

Is it possible to run a specific cronjob via CLI without it being scheduled and without using cron:run? This way we could explicitly trigger the process without depending on any cron schedule.

I cannot imagine how this can work, since the publisher is indeed just not declared, so the issue must occur.

@PromInc
Copy link

PromInc commented Oct 1, 2023

@HenKun to manually run this cron job from the CLI you could do this:

mysql -e "INSERT INTO cron_schedule ( job_code, scheduled_at ) VALUES ( 'catalog_product_alert', CURENT_TIMESTAMP );" && php bin/magento cron:run

This will enter a new entry into the cron_schedule table scheduled for now and then run the cron jobs.
NOTE: you need to have CLI access to MySQL setup for mysql to function. You could also run the query via a GUI or any other MySQL connection you have then run the php bin/magento cron:run portion.

@engcom-Hotel
Copy link
Contributor

Hello @PromInc,

Thanks for the missing step to reproduce the issue. Now we are able to reproduce the issue. But we are getting the mentioned error in system.log file:

image

Hence confirming the issue.

Thanks

@engcom-Hotel engcom-Hotel added Component: Cron Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Area: Framework labels Oct 3, 2023
@m2-community-project m2-community-project bot added this to Dev In Progress in High Priority Backlog Oct 3, 2023
@engcom-Hotel engcom-Hotel removed the Issue: needs update Additional information is require, waiting for response label Oct 3, 2023
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-9637 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Oct 3, 2023

✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Oct 3, 2023
@yegxr
Copy link

yegxr commented Oct 13, 2023

@magento I am working on this

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Oct 13, 2023
davidwindell added a commit to outeredge/magento-disable-common that referenced this issue Oct 13, 2023
@rostilos
Copy link
Contributor

@magento I am working on this

@rostilos rostilos removed their assignment Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Component: Cron Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
High Priority Backlog
  
Dev In Progress
Development

No branches or pull requests

10 participants