mardi 15 septembre 2020

Argument 1 passed to Symfony\Component\HttpFoundation\Request::create() must be of the type string, null given,

trying to upgrade a Laravel project(was 5.4, i am upgrading it to 7), i have run into a brick wall with this. when i run PHP artisan optimize, it gives me this error.

[2020-09-16 05:35:06] production.ERROR: Argument 1 passed to Symfony\Component\HttpFoundation\Request::create() must be of the type string, null given, called in {my_project_path}/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 32 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Symfony\\Component\\HttpFoundation\\Request::create() must be of the type string, null given, called in {my_project_path}/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 32 at {my_project_path}/vendor/symfony/http-foundation/Request.php:329)
[stacktrace]
#0 {my_project_path}/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php(32): Symfony\\Component\\HttpFoundation\\Request::create(NULL, 'GET', Array, Array, Array, Array)
#1 {my_project_path}/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Illuminate\\Foundation\\Bootstrap\\SetRequestForConsole->bootstrap(Object(Illuminate\\Foundation\\Application))
#2 {my_project_path}/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#3 {my_project_path}/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#4 Command line code(1): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#5 {main}
"} 

can someone point me in the right direction how might be able to solve this?

I checked none of the commands is returning anything other than integers in handle function.



via Chebli Mohamed

2 commentaires:

  1. In .env file please set value for APP_URL (APP_URL=localhost)

    RépondreSupprimer
  2. For the next person viewing this post. I had to set app.url in config/app.php to env('APP_URL', 'http://localhost')

    RépondreSupprimer