Closed arthur798 closed 3 years ago
we are facing a similar issue, any updates on this?
Problem for us @vonec is that the code for the package is in try and catch so it never returns an error. In our cause the region was not supporting sns so it needed changing
thank you @arthur798 same problem, region was the issue. thank you
I am still getting the issue, no errors notification/job says it's processed but not getting anything. How do you debug this?
I'm pretty sure this is something related with the SNS setup, either in AWS side or in the project side.
By design, errors are not thrown by the package, in order to give other channels the chance to work properly. As you can see coded here. Knowing that, the first step to debug is somehow listen to the Illuminate\Notifications\Events\NotificationFailed
event (or you can simply dd
in your dev environment to figure out what's going on).
If everything looks fine and you are still not receiving the messages, take a look at the type of message you are sending. When sending Promotional messages, they can take a little more time to reach the destination. Transactional messages have better delivery rates and also costs slightly more. You can set those values via the package, or just stick with the defaults and the settings defined in your AWS account will be used. You can read more about Setting SMS messaging preferences.
Also, be aware that all AWS accounts have a soft limit of 1.00 USD on SNS to prevent abuse. If you reach that limit, you cannot send any more messages. To increase that, you have to open a support ticket and provide all the information required. You can learn How do I request a spending limit increase for SMS messages in Amazon SNS?
Hope that helps.
I got the same issue even if my region is correct.
I had to change my config/services.php from
'sns' => [
'key' => env('SNS_ACCESS_KEY_ID'),
'secret' => env('SNS_SECRET_ACCESS_KEY'),
'region' => env('SNS_DEFAULT_REGION', 'sa-east-1'),
'version' => 'latest',
],
to
'sns' => [
'credentials' => [
'key' => env('SNS_ACCESS_KEY_ID'),
'secret' => env('SNS_SECRET_ACCESS_KEY'),
],
'region' => env('SNS_DEFAULT_REGION', 'sa-east-1'),
'version' => 'latest',
],
If you need to see the error, you can add this line to your app/Providers/EventServiceProvider.php
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
// add this line
Event::listen(function (\Illuminate\Notifications\Events\NotificationFailed $event) {
dd($event);
});
}
Had a similar problem and found success by changing the SMS type to 'Transactional' using the create method.
public function toSns($notifiable)
{
return SnsMessage::create(
[
'body' => "Hi!",
'transactional' => true,
'sender' => 'Me',
]
);
}
Info about the SMS types here: https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html
I had to change my config/services.php from
'sns' => [ 'key' => env('SNS_ACCESS_KEY_ID'), 'secret' => env('SNS_SECRET_ACCESS_KEY'), 'region' => env('SNS_DEFAULT_REGION', 'sa-east-1'), 'version' => 'latest', ],
to
'sns' => [ 'credentials' => [ 'key' => env('SNS_ACCESS_KEY_ID'), 'secret' => env('SNS_SECRET_ACCESS_KEY'), ], 'region' => env('SNS_DEFAULT_REGION', 'sa-east-1'), 'version' => 'latest', ],
If you need to see the error, you can add this line to your app/Providers/EventServiceProvider.php
/** * Register any events for your application. * * @return void */ public function boot() { parent::boot(); // add this line Event::listen(function (\Illuminate\Notifications\Events\NotificationFailed $event) { dd($event); }); }
Changing the way the credentials are saved in config/services.php solved it for me. Thanks!
There was a problem with the way credentials were being passed to the SNS client.
A new version (v1.2.1) was released just now and fixes the issue.
Hi so I have a notification like that:
my user table has a field called
phone_number
but even when doing it like that:and then triggering the notification like that
return \App\Models\User::first()->notify(new \App\Notifications\OTP\SendOTP());
It does not arrive on my phone, what could be the issue as the queue says that it's completed?