brefphp / laravel-bridge

Package to use Laravel on AWS Lambda with Bref
https://bref.sh/docs/frameworks/laravel.html
MIT License
314 stars 63 forks source link

Lumen Settings lambda #7

Closed cemarta7 closed 3 years ago

cemarta7 commented 3 years ago

Hello I keep getting this. "#0 /var/task/vendor/illuminate/database/Eloquent/Model.php(1223): Illuminate\Database\Eloquent\Model::resolveConnection(NULL)", "#1 /var/task/vendor/illuminate/database/Eloquent/Model.php(1052): Illuminate\Database\Eloquent\Model->getConnection()", "#2 /var/task/vendor/illuminate/database/Eloquent/Model.php(969): Illuminate\Database\Eloquent\Model->newBaseQueryBuilder()", "#3 /var/task/vendor/illuminate/database/Eloquent/Model.php(1005): Illuminate\Database\Eloquent\Model->newModelQuery()", "#4 /var/task/vendor/illuminate/database/Eloquent/Model.php(958): Illuminate\Database\Eloquent\Model->newQueryWithoutScopes()", "#5 /var/task/vendor/illuminate/database/Eloquent/Model.php(1622): Illuminate\Database\Eloquent\Model->newQuery()", "#6 /var/task/vendor/illuminate/database/Eloquent/Model.php(1634): Illuminate\Database\Eloquent\Model->__call('create', Array)",

Interesting when the request comes from web the connection to the db has no issues regular bref. But while doing it with lambda I get this error. I did added the security groups as defined on https://bref.sh/docs/environment/database.html

I had to remove this like from the worker in order for it to work. //$kernel->bootstrap();

Could this be also because this is a lumen project not a full laravel version?

maybe something is not loading?

mnapoli commented 3 years ago

Hi, you added the stack trace of the error but not the exception itself (the class name and message). I can't really help further without it.

cemarta7 commented 3 years ago

I fixed it. The issue is that the worker.php was referencing Laravel

$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); $kernel->bootstrap();

But I in Lumen it has to be

$app->make(Laravel\Lumen\Console\Kernel::class); $app->boot();

Hope this helps others.