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

Daemon crash #3

Open
samdgea opened this issue Dec 7, 2019 · 0 comments
Open

Daemon crash #3

samdgea opened this issue Dec 7, 2019 · 0 comments

Comments

@samdgea
Copy link

samdgea commented Dec 7, 2019

Hi, i'm currently trying to implement your library to my project.
I'm use PostgreSQL as my database connection and got this error message

PHP Notice 'yii\base\ErrorException' with message 'unserialize(): Error at offset 112 of 116 bytes'

in /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/bazilio/yii2-async/transports/AsyncMysqlTransport.php:88

Here's the stack trace
Stack trace: #0 [internal function]: yii\base\ErrorHandler->handleError(8, 'unserialize(): ...', '/Users/samdgea/...', 88, Array)
#1 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/bazilio/yii2-async/transports/AsyncMysqlTransport.php(88): unserialize('O:46:"YarCode\\Y...')
#2 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/bazilio/yii2-async/AsyncComponent.php(48): bazilio\async\transports\AsyncMysqlTransport->receive('mailer', false)
#3 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yarcode/yii2-async-mailer/src/MailerCommand.php(24): bazilio\async\AsyncComponent->receiveTask('mailer')
#4 [internal function]: YarCode\Yii2\AsyncMailer\MailerCommand->YarCode\Yii2\AsyncMailer\{closure}(Object(React\EventLoop\Timer\Timer))
#5 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/react/react/src/EventLoop/Timer/Timers.php(90): call_user_func(Object(Closure), Object(React\EventLoop\Timer\Timer))
#6 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/react/react/src/EventLoop/StreamSelectLoop.php(177): React\EventLoop\Timer\Timers->tick()
#7 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yarcode/yii2-daemon/src/DaemonCommand.php(25): React\EventLoop\StreamSelectLoop->run()
#8 [internal function]: YarCode\Yii2\Daemon\DaemonCommand->actionDaemon()
#9 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#11 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('daemon', Array)
#12 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('daemon', Array)
#13 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('mailer/daemon', Array)
#14 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('mailer/daemon', Array)
#15 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request))
#16 /Users/samdgea/Documents/Workspace/Yii2/sipk-yii2/yii(20): yii\base\Application->run()
#17 {main}

Here's my code
private function _sendVerificationEmail($user, $subject = "Please validate your account")
{
$message = Yii::$app->mailer->compose()
->setFrom('[email protected]')
->setTo($user->email_address)
->setSubject($subject)
->setTextBody("Hi, this is your verification code: " . $user->email_verification_hash . "\nPlease ignore if you did not request it");
return Yii::$app->mailer->send($message);
}

and this is my configuration file
$config = [
....
'mailer' => [
'class' => \YarCode\Yii2\AsyncMailer\Mailer::class,
'syncMailer' => [
'class' => yii\swiftmailer\Mailer::class,
'useFileTransport' => true,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.mailtrap.io',
'username' => 'xx',
'password' => '9xx',
'port' => '2525',
'encryption' => 'tls',
],
],
],
...
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant