I have a Job that runs each 10 minutes, and is flooding the laravel.log, so I want to log all his activity to /storage/logs/customJob.log
In /config/logging.php, I added a channel:
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
// ...
'customJob' => [
'driver' => 'single',
'path' => storage_path('logs/customJob.log'),
'level' => 'info',
]
],
and call it in my job with
Log::channel('customJob')->info("test...");
Weird thing is when I try it with tinker or locally, it works well.
But in production, I can see:
in logs/customJob.log, I can see the logs for 10:30, 11:40, 12:10, seems random.
in logs/laravel.log, I can see:
[2021-05-19 12:40:25] laravel.EMERGENCY: Unable to create configured
logger. Using emergency logger. {"exception":"[object]
(ErrorException(code: 0): Undefined array key \"driver\" at
/home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:195)
[stacktrace]
#0 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(195):
Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(118):
Illuminate\\Log\\LogManager->resolve()
#2 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(98):
Illuminate\\Log\\LogManager->get()
#3 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(87):
Illuminate\\Log\\LogManager->driver()
#4 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261):
Illuminate\\Log\\LogManager->channel()
#5 /home/ubuntu/project/app/Jobs/BlockchainToDb.php(104): Illuminate\\Support\\Facades\\Facade::__callStatic()
#6 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36):
App\\Jobs\\BlockchainToDb->handle()
#7 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Util.php(40):
Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#8 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93):
Illuminate\\Container\\Util::unwrapIfClosure()
#9 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37):
Illuminate\\Container\\BoundMethod::callBoundMethod()
#10 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(611):
Illuminate\\Container\\BoundMethod::call()
#11 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128):
Illuminate\\Container\\Container->call()
#12 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128):
Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#13 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103):
Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#14 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132):
Illuminate\\Pipeline\\Pipeline->then()
#15 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118):
Illuminate\\Bus\\Dispatcher->dispatchNow()
#16 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128):
Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#17 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103):
Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120):
Illuminate\\Pipeline\\Pipeline->then()
#19 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70):
Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#20 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98):
Illuminate\\Queue\\CallQueuedHandler->call()
#21 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(410):
Illuminate\\Queue\\Jobs\\Job->fire()
#22 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(360):
Illuminate\\Queue\\Worker->process()
#23 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158):
Illuminate\\Queue\\Worker->runJob()
#24 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117):
Illuminate\\Queue\\Worker->daemon()
#25 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101):
Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#26 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36):
Illuminate\\Queue\\Console\\WorkCommand->handle()
#27 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Util.php(40):
Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#28 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93):
Illuminate\\Container\\Util::unwrapIfClosure()
#29 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37):
Illuminate\\Container\\BoundMethod::callBoundMethod()
#30 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(611):
Illuminate\\Container\\BoundMethod::call()
#31 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(136):
Illuminate\\Container\\Container->call()
#32 /home/ubuntu/project/vendor/symfony/console/Command/Command.php(256):
Illuminate\\Console\\Command->execute()
#33 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(121):
Symfony\\Component\\Console\\Command\\Command->run()
#34 /home/ubuntu/project/vendor/symfony/console/Application.php(971):
Illuminate\\Console\\Command->run()
#35 /home/ubuntu/project/vendor/symfony/console/Application.php(290):
Symfony\\Component\\Console\\Application->doRunCommand()
#36 /home/ubuntu/project/vendor/symfony/console/Application.php(166):
Symfony\\Component\\Console\\Application->doRun()
#37 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Application.php(92):
Symfony\\Component\\Console\\Application->run()
#38 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129):
Illuminate\\Console\\Application->run()
#39 /home/ubuntu/project/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#40 {main} "}
I can see those warning for all the missing timestamps in customJob.log ie 10:40, 10:50, 11:00, 11:10, 11:20, 11:30, 11:50, etc.
Where BlockchainToDb.php(104) correspond to:
Log::channel('customJob')->info("Skipping...");
I also took care of cleaning cache, config, views and route in production:
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan route:clear
Why is it behaving this way ???
Related
I'm trying to put/get an s3 object using Yii 1.1.22 and AWS PHP v3 , and when I try to upload an image to s3 I'm getting below error :
include(php.php): failed to open stream: No such file or directory
stack trace
[error] [php] include(php.php): failed to open stream: No such file or directory (/xxxx/framework/yii/framework/YiiBase.php:463)
yii stack trace:
#0 unknown(0): spl_autoload_call()
#1 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(151): method_exists()
#2 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(113): GuzzleHttp\Promise\Promise->settle()
#3 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(203): GuzzleHttp\Promise\Promise->resolve()
#4 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(156): callHandler()
#5 /xxxx/vendors/aws/GuzzleHttp/Promise/TaskQueue.php(47): GuzzleHttp\Promise\{closure}()
#6 /xxxx/vendors/aws/GuzzleHttp/Handler/CurlMultiHandler.php(96): GuzzleHttp\Promise\TaskQueue->run()
#7 /xxxx/vendors/aws/GuzzleHttp/Handler/CurlMultiHandler.php(123): GuzzleHttp\Handler\CurlMultiHandler->tick()
#8 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(246): GuzzleHttp\Handler\CurlMultiHandler->execute()
#9 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#10 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#11 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#12 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#13 /xxxx/vendors/aws/GuzzleHttp/Promise/Coroutine.php(65): GuzzleHttp\Promise\Promise->wait()
#14 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(246): GuzzleHttp\Promise\Coroutine->GuzzleHttp\Promise\{closure}()
#15 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#16 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#17 /xxxx/vendors/aws/GuzzleHttp/Promise/Coroutine.php(85): GuzzleHttp\Promise\Promise->wait()
#18 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(273): GuzzleHttp\Promise\Coroutine->wait()
#19 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#20 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#21 /xxxx/vendors/aws/Aws/AwsClientTrait.php(59): GuzzleHttp\Promise\Promise->wait()
#22 /xxxx/vendors/aws/Aws/AwsClientTrait.php(78): Aws\S3\S3Client->execute()
#23 /xxxx/protected/extensions/s3/ES3.php(125): Aws\S3\S3Client->__call()
#24 /xxxx/protected/components/Uploader.php(97): ES3->upload()
#25 /xxxx/protected/modules/account/controllers/UserController.php(619): Uploader->upload()
#26 /xxxx/protected/modules/account/controllers/UserController.php(411): UserController->saveUser()
#27 /xxxx/framework/yii/framework/web/actions/CInlineAction.php(49): UserController->actionEditUser()
#28 /xxxx/framework/yii/framework/web/CController.php(308): CInlineAction->runWithParams()
#29 /xxxx/framework/yii/framework/web/CController.php(286): UserController->runAction()
#30 /xxxx/framework/yii/framework/web/CController.php(265): UserController->runActionWithFilters()
#31 /xxxx/framework/yii/framework/web/CWebApplication.php(282): UserController->run()
#32 /xxxx/framework/yii/framework/web/CWebApplication.php(141): CWebApplication->runController()
#33 /xxxx/framework/yii/framework/base/CApplication.php(185): CWebApplication->processRequest()
#34 /xxxx/index.php(36): CWebApplication->run()
REQUEST_URI=/_pfpg_CVWaHvEhl-5MEij5PiF9oCmnFPK6yNHIX7sqetYnfGY_vcsum=b4b2ef23eeb23074c51a8c6631b491861541198cd0ea11492713cb2cd6bfce10
in /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php (151)
in /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php (113)
in /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php (203)
I'm using below code to upload :
$result = $s3->putObject([
'Bucket' => '',
'Key' => 'ogo_1070.png ',
]);
and my s3 config is :
$arrS3Config = [
'region' => ( getenv('APPLICATION_ENV') == 'dr' ) ? 'eu-central-1' : 'us-east-1',
'version' => '2006-03-01',
];
Can any one help me how trace this error at least
Thanks
I have a project that's setup with Laravel and Redis Queues. The application is configured to send push notifications when it receives a message. As soon as message is received, it's stored in the DB and a push is generated:
dispatch(new CreateMessageNotification($message));
Project is using Redis queue and Service Provider. The problem is that queue dispatch doesn't work if we don't execute the following command:
php artisan queue:work redis --daemon
However, when we do run this command, the application start to generate error logs below. It appears that some routine is stuck somewhere, and we're unable to figure out where, why and how? If we don't run this script, push notifications don't work. If we do run this script, push notifications work with delay, and ERROR logs are produced AND the size of log reaches to GB in a matter of an hour. What are we doing wrong here?
We're using Redis/Predis:
'redis' => [
'client' => 'predis',
'cluster' => env('REDIS_CLUSTER', false),
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
'timeout' => 15.0,
],
],
For broadcasting, we're using Pusher:
'default' => env('BROADCAST_DRIVER', 'pusher'),
For queue, we're using Redis:
'default' => env('QUEUE_DRIVER', 'sync'),
QUEUE_DRIVER=redis
For cache, we're using Redis:
'default' => env('CACHE_DRIVER', 'file'),
CACHE_DRIVER=redis
CreateMessageNotification
<?php
namespace App\Jobs\EventHandlers;
use App\Events\Notifications\NewMessageCreatedEvent;
use App\Repositories\UserDevicesRepository;
use Event;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class CreateMessageNotification implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
private $message;
public function __construct($message)
{
$this->message = $message;
}
public function handle()
{
Event::fire(new NewMessageCreatedEvent($this->message));
}
}
NewMessageCreatedEvent
<?php
namespace App\Events\Notifications;
use App\Models\Chat\Message;
use Event;
use Illuminate\Queue\SerializesModels;
class NewMessageCreatedEvent extends Event
{
use SerializesModels;
public function __construct(Message $message)
{
$message->load(['other', 'chat', 'chat.chatUsers']);
foreach ($message->chat->chatUsers as $chatUser) {
if ($chatUser->user_id !== $message->other->id) {
Event::fire(new NewMessageNotificationEvent($message, $chatUser->user_id));
}
}
}
}
ERROR LOG
[2018-09-06 06:28:55] local.ERROR: exception 'Illuminate\Broadcasting\BroadcastException' with message 'API call failed since (daily) message quota exceeded
' in /var/www/html/project/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:106
Stack trace:
#0 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(49): Illuminate\Broadcasting\Broadcasters\PusherBroadcaster->broadcast(Array, 'new_$
#1 [internal function]: Illuminate\Broadcasting\BroadcastEvent->handle(Object(Illuminate\Broadcasting\Broadcasters\PusherBroadcaster))
#2 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array)
#3 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#4 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appli$
#5 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Arr$
#6 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#7 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Illuminate\Broadcasting\Broa$
#8 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Broadcast$
#9 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#10 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(43): Illuminate\Bus\Dispatcher->dispatchNow(Object(Illuminate\Broadcasting\BroadcastEv$
#11 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(69): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#12 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(317): Illuminate\Queue\Jobs\Job->fire()
#13 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(267): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Il$
#14 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Ill$
#15 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('redis', 'default', Object(Illuminate\Queue\Wo$
#16 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default')
#17 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#18 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array)
#19 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#20 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appl$
#21 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Ar$
#22 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)
#23 /var/www/html/project/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\$
#24 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\Ar$
#25 /var/www/html/project/vendor/symfony/console/Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\C$
#26 /var/www/html/project/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symf$
#27 /var/www/html/project/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfon$
#28 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\In$
#29 /var/www/html/project/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Conso$
#30 {main}
[2018-09-06 06:28:55] local.ERROR: exception 'ErrorException' with message 'Trying to get property of non-object' in /var/www/html/project/app/Events/Notifications/NewMessageCreate$
Stack trace:
#0 /var/www/html/project/app/Events/Notifications/NewMessageCreatedEvent.php(27): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Trying to get p...', '/var/www/h$
#1 /var/www/html/project/app/Jobs/EventHandlers/CreateMessageNotification.php(38): App\Events\Notifications\NewMessageCreatedEvent->__construct(Object(App\Models\Chat\Message))
#2 [internal function]: App\Jobs\EventHandlers\CreateMessageNotification->handle()
#3 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array)
#4 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#5 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appli$
#6 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Arr$
#7 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#8 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\EventHandlers\Creat$
#9 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\EventHandle$
#10 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#11 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(43): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\EventHandlers\CreateMessag$
#12 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(69): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#13 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(317): Illuminate\Queue\Jobs\Job->fire()
#14 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(267): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Il$
#15 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Ill$
#16 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('redis', 'default', Object(Illuminate\Queue\Wo$
#17 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default')
#18 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#19 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array)
#20 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#21 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appl$
#22 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Ar$
#23 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)
#24 /var/www/html/project/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\$
#25 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\Ar$
#26 /var/www/html/project/vendor/symfony/console/Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\C$
#27 /var/www/html/project/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symf$
#28 /var/www/html/project/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfon$
#29 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\In$
#30 /var/www/html/project/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Conso$
What worked for me was to remove all failed jobs from the queue (after attempting to retry just one more time):
php artisan queue:restart
php artisan queue:work redis --daemon --tries=1
Re-run the queue:
php artisan queue:work redis --daemon
Also, I had to get rid to calls to Pusher which were failing to get this to work.
When I run php artisan queue:work I get endless loop of published event which is App\Events\PikirPublished
I couldn't find where I made a mistake. But in my log I saw that it is because of Carbon.
[2017-08-09 14:43:20] local.ERROR: InvalidArgumentException: Unexpected data found.
Unexpected data found.
The separation symbol could not be found
Trailing data in /Users/akmyradov/code/pikirler-desktop/vendor/nesbot/carbon/src/Carbon/Carbon.php:582
Stack trace:
#0 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(709): Carbon\Carbon::createFromFormat('Y-m-d H:i:s', 'Sun, 06 Aug 201...')
#1 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(122): Illuminate\Database\Eloquent\Model->asDateTime('Sun, 06 Aug 201...')
#2 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(84): Illuminate\Database\Eloquent\Model->addDateAttributesToArray(Array)
#3 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(900): Illuminate\Database\Eloquent\Model->attributesToArray()
#4 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(929): Illuminate\Database\Eloquent\Model->toArray()
#5 [internal function]: Illuminate\Database\Eloquent\Model->jsonSerialize()
#6 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php(95): json_encode(Array)
#7 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(48): Illuminate\Broadcasting\Broadcasters\RedisBroadcaster->broadcast(Array, 'App\\Events\\Piki...', Array)
#8 [internal function]: Illuminate\Broadcasting\BroadcastEvent->handle(Object(Illuminate\Broadcasting\Broadcasters\RedisBroadcaster))
#9 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#10 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#11 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#12 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#13 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#14 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Illuminate\Broadcasting\BroadcastEvent))
#15 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Broadcasting\BroadcastEvent))
#16 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#17 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(42): Illuminate\Bus\Dispatcher->dispatchNow(Object(Illuminate\Broadcasting\BroadcastEvent), false)
#18 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(69): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#19 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(317): Illuminate\Queue\Jobs\Job->fire()
#20 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(267): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions))
#21 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions))
#22 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('redis', 'default', Object(Illuminate\Queue\WorkerOptions))
#23 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(84): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default')
#24 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#25 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#26 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#27 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#28 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#29 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)
#30 /Users/akmyradov/code/pikirler-desktop/vendor/symfony/console/Command/Command.php(264): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#31 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Console/Command.php(167): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#32 /Users/akmyradov/code/pikirler-desktop/vendor/symfony/console/Application.php(874): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /Users/akmyradov/code/pikirler-desktop/vendor/symfony/console/Application.php(228): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /Users/akmyradov/code/pikirler-desktop/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /Users/akmyradov/code/pikirler-desktop/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 /Users/akmyradov/code/pikirler-desktop/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#37 {main}
I have been stuck on Laravel Passport issue for 4 days now.
Following is my code base to verify login credentials and thus verify user login (token based)
I have followed all the steps for Passport integration.
API I call (From Postman):
http://localhost/oauth/token/?email=admin#test.com&password=Abcd#123&grant_type=password&client_id=10&client_secret=xqVaBzFyC2fVDwyd6Pk7nsy2o45GfYAgUKeR2OjK&scope=*
i.e.
email:admin#test.com
password:Abcd#123
grant_type:password
client_id:3
client_secret:xqVaBsdfsdfsf42fso45GfYAgUKeR2OjK
scope:*
config/auth.php
'defaults' => [
'guard' => 'api',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
But I am getting the error :
{
"error": "unsupported_grant_type",
"message": "The authorization grant type is not supported by the authorization server.",
"hint": "Check the `grant_type` parameter"
}
Error I received
[2017-03-08 12:12:10] local.ERROR: League\OAuth2\Server\Exception\OAuthServerException: The authorization grant type is not supported by the authorization server. in /var/www/html/test/testProj/Proj_Latest/vendor/league/oauth2-server/src/Exception/OAuthServerException.php:65
Stack trace:
#0 /var/www/html/test/testProj/Proj_Latest/vendor/league/oauth2-server/src/AuthorizationServer.php(204): League\OAuth2\Server\Exception\OAuthServerException::unsupportedGrantType()
#1 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/passport/src/Http/Controllers/AccessTokenController.php(63): League\OAuth2\Server\AuthorizationServer->respondToAccessTokenRequest(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
#2 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/passport/src/Http/Controllers/HandlesOAuthErrors.php(25): Laravel\Passport\Http\Controllers\AccessTokenController->Laravel\Passport\Http\Controllers\{closure}()
#3 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/passport/src/Http/Controllers/AccessTokenController.php(64): Laravel\Passport\Http\Controllers\AccessTokenController->withErrorHandling(Object(Closure))
#4 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(47): Laravel\Passport\Http\Controllers\AccessTokenController->issueToken(Object(Zend\Diactoros\ServerRequest))
#5 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Laravel\Passport\Http\Controllers\AccessTokenController), 'issueToken')
#6 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Route.php(160): Illuminate\Routing\Route->runController()
#7 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(559): Illuminate\Routing\Route->run()
#8 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#9 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#10 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Routing\Middleware\ThrottleRequests->handle(Object(Illuminate\Http\Request), Object(Closure))
#11 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#12 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#13 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(561): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#14 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(520): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#15 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(498): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#16 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(174): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#17 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#18 /var/www/html/test/testProj/Proj_Latest/app/Http/Middleware/ResponseLogger.php(22): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#19 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\ResponseLogger->handle(Object(Illuminate\Http\Request), Object(Closure))
#20 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#21 /var/www/html/test/testProj/Proj_Latest/app/Http/Middleware/RequestLogger.php(45): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#22 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\RequestLogger->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 /var/www/html/test/testProj/Proj_Latest/app/Http/Middleware/Cors.php(18): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#25 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\Cors->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#28 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#31 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#34 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#37 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#40 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#43 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#46 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(149): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#47 /var/www/html/test/testProj/Proj_Latest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#48 /var/www/html/test/testProj/Proj_Latest/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#49 {main}
Now since this did not work, I tried the method :
Auth::attempt(array('email' => 'admin#test.com', 'password' => 'Abcd#123'))
But this time I received :
[2017-03-08 12:00:00] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Auth\RequestGuard::attempt() in /var/www/html/..../vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php:294
Nothing seems to be working in Laravel 5.4
First of all, make sure that the grant client is a 'password client', creaded similiarly as with the command:
php artisan passport:client --password
This means that the 'password_client' column in the database has the value '1' next to the corresponding client.
I also struggled a lot with the default user clients created from the user interface, and it doesn't work with those.
I've spent all night trying different things and for the life of me I cannot get my site to send emails. I just deployed my first Laravel project to a live server (digitalocean), yet when on my vagrant dev machine I have no problems sending email, it isn't until I deploy that the problems began.
I know the 500 error is usually due to the CSRF tokens and passing them in your headers, but I am doing that and am still getting an error. I will post the code I assume would be relevant and if anyone can see what the hell I am doing wrong I will forever be in your debt.
MAIL: (Asterix for privacy)
return [
'driver' => 'smtp',
'host' => 'smtp.mandrillapp.com',
'port' => 587,
'from' => array('address' => '********#gmail.com', 'name' => 'Admin'),
'encryption' => 'tls',
'username' => '********#gmail.com',
'password' => '****************',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
];
HomeController #store method for email sending (works on dev)
public function store(ContactFormRequest $request)
{
Mail::send('emails.email', array(
'name' => $request->get('name'),
'email' => $request->get('email'),
'user_message' => $request->get('user_message')
), function($message)
{
$message->from('*********#gmail.com');
$message->to('********#gmail.com', 'Admin')->subject('Client Inquiry');
});
return Response::json(['response' => 200]);
}
AJAX (jQuery)
$('#submit-contact-form').click(function(e) {
e.preventDefault();
$('#submit-contact-form').val('Sending...');
var $form = $(this).parent('form');
var $action = $form.attr('action');
var $data = $form.serialize();
$.ajax({
url: $action,
method: 'POST',
headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') },
data: $data,
success: function(data) {
if (data.response == 200) {
$('#submit-contact-form').val('Thank You For Contacting Us!');
}
}
});
});
Routes.php: (contact form is on my homepage and posts to itself, works on dev)
Route::resource('/', 'HomeController', ['only' => ['index','store']]);
Finally Form: (discovered if posting to root, for the url you have to pass empty string with a space in it
{!! Form::open(array('url' => ' ', 'id' => 'contact-form')) !!}
blah blah blah
{!! Form::close() !!}
I am new to Laravel so i'm still learning, but this one has me stuck especially because it works on dev and not production.
Here is my error log:
[2015-05-14 06:29:01] production.ERROR: exception 'ErrorException' with message 'Missing argument 1 for Illuminate\Support\Manager::createDriver(), called in /var/www/html/kraken/vendor/compiled.php on line 11268 and defined' in /var/www/html/kraken/vendor/compiled.php:11262
Stack trace:
#0 /var/www/html/kraken/vendor/compiled.php(11262): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Missing argumen...', '/var/www/html/k...', 11262, Array)
#1 /var/www/html/kraken/vendor/compiled.php(11268): Illuminate\Support\Manager->createDriver()
#2 /var/www/html/kraken/vendor/compiled.php(11258): Illuminate\Support\Manager->createDriver(NULL)
#3 /var/www/html/kraken/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php(92): Illuminate\Support\Manager->driver()
#4 /var/www/html/kraken/vendor/compiled.php(827): Illuminate\Mail\MailServiceProvider->Illuminate\Mail\{closure}(Object(Illuminate\Foundation\Application))
#5 /var/www/html/kraken/vendor/compiled.php(1027): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate\Foundation\Application), Array)
#6 /var/www/html/kraken/vendor/compiled.php(980): Illuminate\Container\Container->build(Object(Closure), Array)
#7 /var/www/html/kraken/vendor/compiled.php(1493): Illuminate\Container\Container->make('swift.mailer', Array)
#8 /var/www/html/kraken/vendor/compiled.php(1213): Illuminate\Foundation\Application->make('swift.mailer')
#9 /var/www/html/kraken/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php(30): Illuminate\Container\Container->offsetGet('swift.mailer')
#10 /var/www/html/kraken/vendor/compiled.php(1027): Illuminate\Mail\MailServiceProvider->Illuminate\Mail\{closure}(Object(Illuminate\Foundation\Application), Array)
#11 /var/www/html/kraken/vendor/compiled.php(980): Illuminate\Container\Container->build(Object(Closure), Array)
#12 /var/www/html/kraken/vendor/compiled.php(1493): Illuminate\Container\Container->make('mailer', Array)
#13 /var/www/html/kraken/vendor/compiled.php(1213): Illuminate\Foundation\Application->make('mailer')
#14 /var/www/html/kraken/vendor/compiled.php(5276): Illuminate\Container\Container->offsetGet('mailer')
#15 /var/www/html/kraken/vendor/compiled.php(5262): Illuminate\Support\Facades\Facade::resolveFacadeInstance('mailer')
#16 /var/www/html/kraken/vendor/compiled.php(5296): Illuminate\Support\Facades\Facade::getFacadeRoot()
#17 /var/www/html/kraken/app/Http/Controllers/HomeController.php(28): Illuminate\Support\Facades\Facade::__callStatic('send', Array)
#18 /var/www/html/kraken/app/Http/Controllers/HomeController.php(28): Illuminate\Support\Facades\Mail::send('emails.email', Array, Object(Closure))
#19 [internal function]: App\Http\Controllers\HomeController->store(Object(App\Http\Requests\ContactFormRequest))
#20 /var/www/html/kraken/vendor/compiled.php(8287): call_user_func_array(Array, Array)
#21 /var/www/html/kraken/vendor/compiled.php(8354): Illuminate\Routing\Controller->callAction('store', Array)
#22 /var/www/html/kraken/vendor/compiled.php(8333): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\HomeController), Object(Illuminate\Routing\Route), 'store')
#23 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /var/www/html/kraken/vendor/compiled.php(8952): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#25 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /var/www/html/kraken/vendor/compiled.php(8935): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#27 /var/www/html/kraken/vendor/compiled.php(8334): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#28 /var/www/html/kraken/vendor/compiled.php(8320): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\HomeController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'store')
#29 /var/www/html/kraken/vendor/compiled.php(7317): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'store')
#30 /var/www/html/kraken/vendor/compiled.php(7288): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#31 /var/www/html/kraken/vendor/compiled.php(6954): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#32 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#33 /var/www/html/kraken/vendor/compiled.php(8952): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#34 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /var/www/html/kraken/vendor/compiled.php(8935): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#36 /var/www/html/kraken/vendor/compiled.php(6955): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#37 /var/www/html/kraken/vendor/compiled.php(6944): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#38 /var/www/html/kraken/vendor/compiled.php(6929): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#39 /var/www/html/kraken/vendor/compiled.php(1935): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#40 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#41 /var/www/html/kraken/vendor/compiled.php(8952): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#42 /var/www/html/kraken/vendor/compiled.php(2438): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 /var/www/html/kraken/app/Http/Middleware/VerifyCsrfToken.php(17): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /var/www/html/kraken/vendor/compiled.php(8944): App\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#45 /var/www/html/kraken/vendor/compiled.php(12083): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#46 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 /var/www/html/kraken/vendor/compiled.php(10785): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 /var/www/html/kraken/vendor/compiled.php(11789): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#50 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#51 /var/www/html/kraken/vendor/compiled.php(11738): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#52 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 /var/www/html/kraken/vendor/compiled.php(2478): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#54 /var/www/html/kraken/vendor/compiled.php(8944): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#55 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#56 /var/www/html/kraken/vendor/compiled.php(8935): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#57 /var/www/html/kraken/vendor/compiled.php(1891): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#58 /var/www/html/kraken/vendor/compiled.php(1880): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#59 /var/www/html/kraken/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#60 {main}
I've already gone to Laracast and posted but didn't get any responses, if anyone can help me I would appreciate it so much, thanks guys.