0

I deployed a laravel + React application on aws Beanstalk ,the app fetches data but trows error when i try to login using the login end point and everything works fine locally on my Laptop. How do i solve the problem it does not log the specific error.

Axios.post('/auth/register', data)
            .then((response) => {
                setLoading(false)
                setSuccess(true);

                addToast(<div><b>Registration</b><br /><p>{response.data.message}</p></div>, {
                    appearance: 'info',
                    autoDismiss: false,
                })
            })
            .catch((err) => {
                setIsLoggedIn(false);
                setAuthUser({});

                // var errMessage = '';
                // if (err.response.data.errors) {
                //     err.response.data.errors.map((error) => {
                //         errMessage += <>{error} <br></br></>
                //         errMessage += error + ' ' + <br></br>
                //     })
                // }
                addToast(<div><b>Registration</b><br /><p>{err.response.data.errors}</p></div>, {
                    appearance: 'error',
                    autoDismiss: false,
                })

                setLoading(false)
                setSuccess(false);
            })


Here is what is in the log file

#0 /var/app/current/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(248): Monolog\\Logger->__construct(NULL, Array)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(202): Illuminate\\Log\\LogManager->createStackDriver(Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(118): Illuminate\\Log\\LogManager->resolve('stack')
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(98): Illuminate\\Log\\LogManager->get('stack')
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(543): Illuminate\\Log\\LogManager->driver()
#5 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(123): Illuminate\\Log\\LogManager->error('Argument 1 pass...', Array)
#6 /var/app/current/app/Exceptions/Handler.php(39): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(TypeError))
#7 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(49): App\\Exceptions\\Handler->report(Object(TypeError))
#8 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(172): Illuminate\\Routing\\Pipeline->handleException(Object(Illuminate\\Http\\Request), Object(TypeError))
#9 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#10 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#11 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#12 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#13 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#14 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#15 /var/app/current/vendor/fruitcake/laravel-cors/src/HandleCors.php(52): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#16 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))

pjoe
  • 43
  • 7
  • 1
    @TimLewis i have added the content of the log file – pjoe Feb 07 '22 at 19:38
  • 1
    Much better! Your error looks like `Argument 1 passed to ...`, which usually means that a type-hinted argument, like `Array $array` is being passed incorrectly, i.e. as a string, int, object, etc. Beyond that, I still don't know what your error is or what's triggering it. – Tim Lewis Feb 07 '22 at 19:39
  • 1
    @TimLewis copied from the first line now – pjoe Feb 07 '22 at 19:42
  • Looks like a configuration issue; what do you have set as your `LOG_DRIVER` (or `LOG_CHANNEL`) in `.env` file? – Tim Lewis Feb 07 '22 at 19:44
  • 1
    @TimLewis LOG_CHANNEL=stack – pjoe Feb 07 '22 at 19:45
  • Confirmed by `->get('stack')`; that seems like the correct value. For some reason, your logging is not working, but I'm not 100% sure why; I've personally never seen this error. I'll try to recreate locally, see if I can figure out the cause. If you do `php artisan tinker`, then `\Log::info('Logging Test')`, do you get the same error? – Tim Lewis Feb 07 '22 at 19:48
  • 1
    @TimLewisthanks will try that now – pjoe Feb 07 '22 at 19:49
  • 1
    @TimLewis i saw this on top of the log file laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Monolog\\Logger::__construct() must be of the type string, null given, called in /var/app/current/vendor/laravel/framework/src/Illuminate/Log/LogManager.php on line 248 at /var/app/current/vendor/monolog/monolog/src/Monolog/Logger.php:158) [stacktrace] – pjoe Feb 07 '22 at 19:58
  • Nice! First Google search for that error is from a Stripe integration: https://github.com/laravel/cashier-stripe/issues/860; does that line up with your project? Otherwise, there are other questions/answers for that error on SO too that might help: https://stackoverflow.com/questions/49073558/laravel-5-6-upgrade-caused-logging-to-break – Tim Lewis Feb 07 '22 at 20:00
  • @TimLewis thanks will check this out – pjoe Feb 07 '22 at 20:05

0 Answers0