spatie / mailcoach-support

Questions and support for Mailcoach
https://mailcoach.app
31 stars 2 forks source link

Unprocessed Webhooks #276

Closed StanBarrows closed 3 years ago

StanBarrows commented 3 years ago

Describe your issue

After I've sent out an initial campaign I receive a few email statistics but somehow a lot of feedbacks stays unprocessed within the database.


Health check:

Environment: production Debug: OFF Horizon: Active Queue connection: OK Webhooks: 18 unprocessed webhooks Schedule: ran 0 minute(s) ago Default mailer: postmark Mailcoach mailer: null Campaign mailer: null Transactional mailer: null

Technical details

App directory: /home/forge/mailcoach.domain User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15 PHP version: 7.4.10 MySQL version: 8.0.21 Laravel version: 8.13.0 Horizon version: v5.4.0@d08d10ee12f53b7ba2cbb938eb23857e93fe51d3 laravel-mailcoach version: 3.2.9

Images

image

image

image

image

riasvdv commented 3 years ago

Could you check your-domain.com/horizon to see if there are any jobs that have errors?

StanBarrows commented 3 years ago

Hi @riasvdv

Thanks for your reply.

Everything looks normal.

image

image

riasvdv commented 3 years ago

Can you check the webhook_calls table for the webhooks that are not processed and give an example of one? (make sure to censor any sensitive data)

StanBarrows commented 3 years ago

Hi @riasvdv sure no problem.

The unprocessed web-hooks increased to 32 by now. The types are all from postmark-feedback but there two different payload types of WebHook Calls.

1

{"OS": {"Name": "iOS", "Family": "iOS", "Company": "Apple Inc."}, "Geo": {"IP": "84.***.**.**", "Zip": "4055", "City": "Basel", "Coords": "47.5584,7.5733", "Region": "Basel-City", "Country": "Switzerland", "RegionISOCode": "BS", "CountryISOCode": "CH"}, "Tag": null, "Client": {"Name": "iOS", "Family": "iOS", "Company": "Apple Inc."}, "Metadata": [], "Platform": "Mobile", "FirstOpen": false, "MessageID": "d4717dc0-****-4297-****-599320aad022", "Recipient": "sebastian@***.ch", "UserAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", "ReceivedAt": "2020-11-11T13:03:34Z", "RecordType": "Open", "ReadSeconds": 0, "MessageStream": "outbound"}

2

{"Tag": null, "Details": "smtp;250 2.6.0 <c47730c2e86e93c52215e33860****@swift.generated> [InternalId=4446579641****, Hostname=ZR0P278MB****.CHE****.PROD.OUTLOOK.COM] 42403 bytes in 0.095, 435.033 KB/sec Queued mail for delivery", "Metadata": [], "ServerID": 566****, "MessageID": "d4717dc0-7a0a-4297-930f-599320aad022", "Recipient": "dominique@***.ch", "RecordType": "Delivery", "DeliveredAt": "2020-11-11T11:00:14Z", "MessageStream": "outbound"}

processed_at & exception columns are empty.

Also happy to provide you an SQL/CSV Export of the current web-hooks table or access to the privat repository.

StanBarrows commented 3 years ago

Just would like to crosscheck that I have added the Mailcoach routes correctly.

RouteServiceProvider

   $this->configureRateLimiting();

        $this->routes(function () {
            Route::prefix('api')
                ->middleware('api')
                ->namespace($this->namespace)
                ->group(base_path('routes/api.php'));

            Route::middleware('web')
                ->namespace($this->namespace)
                ->group(base_path('routes/web.php'));

            Route::mailcoach('mailcoach');
            Route::mailcoachUnlayer('mailcoachUnlayer');
            Route::postmarkFeedback('postmark-feedback');
        });

According to the Laravel 8 update i thought the map method was replaced.

image

https://mailcoach.app/docs/v2/package/general/installation-and-setup

riasvdv commented 3 years ago

You're looking at the v2 docs, in your project I see you have v3 installed, so make sure to follow those instructions, there are slight differences: https://mailcoach.app/docs/v3/package/general/installation-and-setup

StanBarrows commented 3 years ago

Hi @riasvdv Sorry I was double checking the wrong docs yesterday night. I have initially installed it with the correct v3 docs.

riasvdv commented 3 years ago

I've looked at the payload and it seems your webhooks are missing the Metadata, it should contain a send-uuid:

"Metadata" : {
  "send-uuid" : "my-uuid"
}

Which should be added here https://github.com/spatie/laravel-mailcoach/blob/master/src/Actions/Campaigns/SendMailAction.php#L61

Are you using a custom SendMailAction?

freekmurze commented 3 years ago

We might have solved this in one of the recent mailcoach versions. We now ignore webhooks for which a Send model (which represents a sent mail) could not be found.

We recommend upgrading to the latest release, marking all current webhooks as processed.

Do open up a new issue if you see this behaviour again in the latest version of Mailcoach.