Undefined property: stdClass::$errors
kejubayer opened this issue · 9 comments
I'm trying to create a status. But when I hit the URL, I get the error "Undefined property: stdClass::$errors"
My code below.
public function via($notifiable): array
{
return [TwitterChannel::class];
}
public function toTwitter($notifiable)
{
return new TwitterStatusUpdate('Laravel notifications are awesome!');
}
route
Route::get('/test', function () {
Notification::route(\NotificationChannels\Twitter\TwitterChannel::class,'')
->notify(new TwitterNotification());
});
In composer.json
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.9.2",
"laravel-notification-channels/twitter": "^4.1.0",
"laravel/tinker": "^2.0"
},
Was this working before or is this a new install? And can you show the full error message, please?
Can you try to send a notification via a model like a user please and tell me if that works?
$user = new User();
$user->notify(new TestNotification());
@kejubayer could you check the api respond?
like by changing the code => ./vendor/laravel-notification-channels/twitter/src/Exceptions/CouldNotSendNotification.php
/**
* @param $response
* @return CouldNotSendNotification
*/
public static function serviceRespondsNotSuccessful($response)
{
dd($response);
$responseBody = print_r($response->errors[0]->message, true);
return new static("Couldn't post notification. Response: ".$responseBody);
}
It looks like that the response doesn't follow the expected behavior....
@kejubayer => ok i think i found the problem!
Please check if your access_token / secret pair is allowed to post.
I created a PR #70 to fix that.
Hope that helps you.
Thank You, I got the real error. And the problem is solved.
Was it the insufficient permission issue or something else?
Yes, It was permission issue.