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

Mollie webhook retrying after getting 500 due to spam rejection SMTP #774

Open
erwinschaap opened this issue Apr 29, 2024 · 8 comments
Open
Assignees
Labels
Investigating We are working on this issue together with the customer. Question / Issue Further information is requested

Comments

@erwinschaap
Copy link

Describe the bug
When a user could not receive e-mails due to spam rejection, the mollie webhook calls gets 500 response code and will try every x time. The order is already invoiced with the first mollie webhook and the state is complete but every time the mollie webhook is triggered, the state is changing back to processing and mollie is capturing a new transaction

Used versions

  • Magento Version number(eg 2.3.5): 2.4.6-p3
  • Open source/Enterprise/B2b: Open source
  • Mollie version number (Check configuration): 2.34.0

To Reproduce
Steps to reproduce the behavior:
Mollie webhook getting 500 response due to an error in SMTP (e.g. spam rejection)
A new transaction is captured and the state will be processing again (the order status for completed payments)

Expected behavior
When a Mollie webhook is getting 500 response due to SMTP errors, the actual result should be a 200 OK for the Mollie workflow

Actual behavior
It is returning a 500 internal server error

@Frank-Magmodules
Copy link
Collaborator

Hi There @erwinschaap,

Thank you for opening this issue. Could it be that you are using an external module for sending emails?
We have tried various scenarios using Mailhog, but whenever an error occurs during email sending this is handled as expected. It is logged in both the exception.log and debug.log, but it is not shown to the end-user.

So I’m expecting that you are using some kind of external module that is causing this issue.
Thanks!

@Frank-Magmodules Frank-Magmodules added the Investigating We are working on this issue together with the customer. label May 1, 2024
@erwinschaap
Copy link
Author

We are using Mageplaza SMTP (I think one of the most used module) https://github.com/mageplaza/magento-2-smtp

@Frank-Magmodules
Copy link
Collaborator

Ah ok, that's new information, thanks, will check it out @erwinschaap !

@Frank-Magmodules
Copy link
Collaborator

We investigated this once again, this time while using the Mageplaza SMTP module. We still seem to be unable to reproduce this. Mageplaza wraps its code around \Magento\Framework\Mail\TransportInterface::sendMessage, the same method that is being used by the native Magento implementation.

This method is for both the invoice and the order confirmation called by \Magento\Sales\Model\Order\Email\Sender::checkAndSend. That method tries to call the sendMessage method, but catches any exception (see code). When an exception occurs, this is logged and false is returned.

From the looks, this does not seem to be the cause of the problem that you are experiencing. What the exact cause then is, is hard to say. Are you able to share more information about what is going on and what errors you are experiencing?
The email errors might popup in the logs, but do not seem to be related.

@erwinschaap
Copy link
Author

We have updated all the modules and the issue still exists:

We are getting this error message in the logs:
[2024-05-10T13:35:59.959010+00:00] main.ERROR: 5.2.0 x Spam Rejected (x= some id)

In the Mollie dashboard:
Aanroepen webhook mislukt met statuscode 500 (Internal Server Error) 10 mei 2024 om 15:35

Exactly at the same time, first is because the SMTP service is getting Spam Rejected

@Frank-Magmodules
Copy link
Collaborator

Hi @erwinschaap,

That a 500 error is received is not good, but it’s hard to say what the exact cause is. As told before, the error is probably only logged but not shown. If it were shown on screen it would mean you would receive it also when creating shipments, invoices, or credit memos.

The error is probably hidden somewhere in your logs. It might be in the exception.log, debug.log or maybe even the PHP logs. But with the current information, it is very hard for us to help you any further.

@erwinschaap
Copy link
Author

Hard to tackle this issue because there are no complementary logs in the exception, system, mollie logs:

  • We are using the Order API for most payment methods
  • The problem with 500's in the webhook is only when having SMTP issues (SPAM rejected, receipt policy rejections)
  • In the Mollie logs there are no issues, we are receiving always success results:
    success: {"success":true,"status":"paid","order_id":"x","type":"webhook"} [] []
  • In the Mollie dashboard there are only 500's received somehow
  • Because of the 500's, there are periodically retries to get a success result
  • In Magento all went well and because of that all orders status are resetting everytime the webhook is called

We are having not enough information to really see what the problem is

@Frank-Magmodules Frank-Magmodules added the Question / Issue Further information is requested label May 16, 2024
@Frank-Magmodules
Copy link
Collaborator

Hi @erwinschaap,
What’s the best way to proceed? I'm a bit lost at this point and can’t confidently conclude that this is a Mollie-related issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigating We are working on this issue together with the customer. Question / Issue Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants