cbaykam's avatar

Mongo with Lumen White screen with status code 200

Hi ; I am trying to code a micro service with Lumen using an existing mongo collection.

And with this app.php I am getting a white screen without any error in lumen.log and homesteads nginx error file.

<?php

require_once __DIR__.'/../vendor/autoload.php';

Dotenv::load(__DIR__.'/../');

$app = new Laravel\Lumen\Application(
    realpath(__DIR__.'/../')
);

$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class);

$app->withFacades();
$app->withEloquent();

$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    App\Exceptions\Handler::class
);

$app->singleton(
    Illuminate\Contracts\Console\Kernel::class,
    App\Console\Kernel::class
);

$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
    require __DIR__.'/../app/Http/routes.php';
});

return $app;

When I debug

It breaks at the $app->register for the mongodb And the problem is with the line

 Model::setConnectionResolver($this->app['db']);

However when I debug to see if anything else is wrong.

The line

 $app->withEloquent();

fails too with a status code of 200 and no error message :(

Forgot to tell the storage has the permissions 777

0 likes
1 reply
cbaykam's avatar

And I see that the problem is the db is not bind to the $app instance. Therefore app dies on both the Jennsengers Mongo and in withEloquent call. So the problem is if the db is not bind to the app how can I bind it?

Please or to participate in this conversation.