While installing a fresh new version on my testing environment "composer install" ends with a UrlGenerator error message. Any attempt to call cli commads ends with a UrlGenerator error message.

My composer.json is
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"moontoast/math": "^1.0",
"league/flysystem-aws-s3-v3": "~1.0",
"league/flysystem-cached-adapter": "~1.0",
"laravel/cashier": "^9.3.0"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
Run cli command "composer install"
What's in your composer.json file? The package.json file relates to your JavaScript side of things. The composer.json file will have the info about your PHP dependencies? :)
It sounds like a service provider is trying to generate urls outside of a request context. Check your application logs for the full stacktrace to find out what is causing the problem
@ash-jc-allen I'm sorry I post the wrong file (I was going to sleep) I updated the post.
I try with another small project and again, after updating to laravel 5.8.29, composer ends with the same UrlGenerator error
@sisve I found that i have a call to and asset() with a relative path inside a config file.
[2019-07-26 09:05:59] production.ERROR: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /var/www/.../vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 2 passed to Illuminate\\Routing\\UrlGenerator::__construct() must be an instance of Illuminate\\Http\\Request, null given, called in /var/www/.../vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 at /var/www/.../vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:119)
[stacktrace]
#0 /var/www/.../vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\\Routing\\UrlGenerator->__construct(Object(Illuminate\\Routing\\RouteCollection), NULL, NULL)
#1 /var/www/.../vendor/laravel/framework/src/Illuminate/Container/Container.php(787): Illuminate\\Routing\\RoutingServiceProvider->Illuminate\\Routing\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
#2 /var/www/.../vendor/laravel/framework/src/Illuminate/Container/Container.php(667): Illuminate\\Container\\Container->build(Object(Closure))
#3 /var/www/.../vendor/laravel/framework/src/Illuminate/Container/Container.php(615): Illuminate\\Container\\Container->resolve('url', Array)
#4 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(767): Illuminate\\Container\\Container->make('url', Array)
#5 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(121): Illuminate\\Foundation\\Application->make('url', Array)
#6 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(148): app('url')
#7 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(795): asset('/images/brandin...', true)
#8 /var/www/.../config/meta.php(82): secure_asset('/images/brandin...')
#9 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(72): require('/var/www/vhosts...')
#10 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->loadConfigurationFiles(Object(Illuminate\\Foundation\\Application), Object(Illuminate\\Config\\Repository))
#11 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(210): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap(Object(Illuminate\\Foundation\\Application))
#12 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(322): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#13 /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#14 /var/www/.../artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#15 {main}
"}
this is the stack trace, caused by "config/meta.php"
<?php
return [
/*
|--------------------------------------------------------------------------
| Image
|--------------------------------------------------------------------------
|
| Here you may provide the url to the image you want search
| engines and crawlers to make use of when displaying your website
| or a specific page page.
|
*/
'logo' => secure_asset( '/images/branding/open_graph/logo-1200x1200.png' ),
how do I call an asset from inside a config file?
@Mindexperiment I've just had a quick test on my local machine and this seems to work:
Sorry for bad formatting and no markdown, I'm on my phone so it's a bit difficult.
@ash-jc-allen thank you for your help, well I can call the asset() inside the metadata view.
<meta name="twitter:image:src" content="{{ asset( ( !empty( $logo )? $logo : config( 'meta.logo' ) ) }}" />
I definetly need a vacation. This issue can be closed. Thank you
Most helpful comment
@sisve I found that i have a call to and asset() with a relative path inside a config file.
this is the stack trace, caused by "config/meta.php"
how do I call an asset from inside a config file?