LibreNMS broken after July 9 update

Tags: #<Tag:0x00007f84b16ed0d8>

Hello there, I’m not 100% sure when the issue happened, but I believe it was the July 9 update that automatically took place earlier this AM. The web UI will no longer load (see screenshot).

I’ve also attached the relevant part of the librenms.log, as well as validate.php.

Also, we are running Ubuntu 18.04.4.

Please help, thanks so much!
~Laz

====================================
Component | Version
--------- | -------
LibreNMS  | 1.65-22-g98d6fc1ac
DB Schema | 2020_06_23_00522_alter_availability_perc_column (170)
PHP       | 7.2.24-0ubuntu0.18.04.6
Python    | 3.6.9
MySQL     | 5.7.30-0ubuntu0.18.04.1
RRDTool   | 1.7.0
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Composer Version: 1.10.8
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct

[2020-07-09 10:42:06] production.ERROR: CORS config `allowed_origins` should be an array {"exception":"[object] (RuntimeException(code: 0): CORS config `allowed_origins` should be an array at /opt/librenms/vendor/fruitcake/laravel-cors/src/CorsServiceProvider.php:64)
[stacktrace]
#0 /opt/librenms/vendor/fruitcake/laravel-cors/src/CorsServiceProvider.php(22): Fruitcake\\Cors\\CorsServiceProvider->corsOptions()
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(801): Fruitcake\\Cors\\CorsServiceProvider->Fruitcake\\Cors\\{closure}(Object(App\\Application), Array)
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build(Object(Closure))
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('Asm89\\\\Stack\\\\Cor...', Array, true)
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('Asm89\\\\Stack\\\\Cor...', Array)
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('Asm89\\\\Stack\\\\Cor...', Array)
#6 /opt/librenms/app/Http/Middleware/HandleCors.php(58): Illuminate\\Foundation\\Application->make('Asm89\\\\Stack\\\\Cor...')
#7 [internal function]: App\\Http\\Middleware\\HandleCors->__construct(Object(App\\Application))
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(845): ReflectionClass->newInstanceArgs(Array)
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build('App\\\\Http\\\\Middle...')
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('App\\\\Http\\\\Middle...', Array, true)
#11 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('App\\\\Http\\\\Middle...', Array)
#12 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('App\\\\Http\\\\Middle...', Array)
#13 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(156): Illuminate\\Foundation\\Application->make('App\\\\Http\\\\Middle...')
#14 /opt/librenms/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#15 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#16 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#17 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#18 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(109): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#19 /opt/librenms/html/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#20 {main}
"} 
[2020-07-09 10:42:06] production.ERROR: CORS config `allowed_origins` should be an array {"exception":"[object] (RuntimeException(code: 0): CORS config `allowed_origins` should be an array at /opt/librenms/vendor/fruitcake/laravel-cors/src/CorsServiceProvider.php:64)
[stacktrace]
#0 /opt/librenms/vendor/fruitcake/laravel-cors/src/CorsServiceProvider.php(22): Fruitcake\\Cors\\CorsServiceProvider->corsOptions()
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(801): Fruitcake\\Cors\\CorsServiceProvider->Fruitcake\\Cors\\{closure}(Object(App\\Application), Array)
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build(Object(Closure))
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('Asm89\\\\Stack\\\\Cor...', Array, true)
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('Asm89\\\\Stack\\\\Cor...', Array)
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('Asm89\\\\Stack\\\\Cor...', Array)
#6 /opt/librenms/app/Http/Middleware/HandleCors.php(58): Illuminate\\Foundation\\Application->make('Asm89\\\\Stack\\\\Cor...')
#7 [internal function]: App\\Http\\Middleware\\HandleCors->__construct(Object(App\\Application))
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(845): ReflectionClass->newInstanceArgs(Array)
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build('App\\\\Http\\\\Middle...')
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('App\\\\Http\\\\Middle...', Array, true)
#11 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('App\\\\Http\\\\Middle...', Array)
#12 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('App\\\\Http\\\\Middle...', Array)
#13 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(204): Illuminate\\Foundation\\Application->make('App\\\\Http\\\\Middle...')
#14 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(178): Illuminate\\Foundation\\Http\\Kernel->terminateMiddleware(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#15 /opt/librenms/html/index.php(58): Illuminate\\Foundation\\Http\\Kernel->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#16 {main}
"} 

What is the output of ./lnms config:get api.cors.origin

It is:

$ ./lnms config:get api.cors.origin
*

have at least one other report of a similar error.

@murrant would I run the following in order to get a fix?

./scripts/github-apply 11921

sure, but better yet is test it and report that it works and it will get merged for everyone.

Ok – just so I don’t mess myself up, that was the correct command and fix # for this one, yes?

Thanks Tony.

yes, but once it is merged upstream, you will need to remove it from your local install so you can update.

Ok, done. It is now giving new issue:

[2020-07-09 12:26:53] production.ERROR: getenv() expects parameter 1 to be string, array given {"exception":"[object] (ErrorException(code: 0): getenv() expects parameter 1 to be string, array given at /opt/librenms/LibreNMS/Util/EnvHelper.php:187)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'getenv() expect...', '/opt/librenms/L...', 187, Array)
#1 /opt/librenms/LibreNMS/Util/EnvHelper.php(187): getenv(Array)
#2 /opt/librenms/app/Http/Middleware/HandleCors.php(52): LibreNMS\\Util\\EnvHelper::parseArray(Array)
#3 [internal function]: App\\Http\\Middleware\\HandleCors->__construct(Object(App\\Application))
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(845): ReflectionClass->newInstanceArgs(Array)
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build('App\\\\Http\\\\Middle...')
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('App\\\\Http\\\\Middle...', Array, true)
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('App\\\\Http\\\\Middle...', Array)
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('App\\\\Http\\\\Middle...', Array)
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(156): Illuminate\\Foundation\\Application->make('App\\\\Http\\\\Middle...')
#10 /opt/librenms/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#11 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#12 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#13 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#14 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(109): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#15 /opt/librenms/html/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#16 {main}
"} 
[2020-07-09 12:26:53] production.ERROR: getenv() expects parameter 1 to be string, array given {"exception":"[object] (ErrorException(code: 0): getenv() expects parameter 1 to be string, array given at /opt/librenms/LibreNMS/Util/EnvHelper.php:187)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'getenv() expect...', '/opt/librenms/L...', 187, Array)
#1 /opt/librenms/LibreNMS/Util/EnvHelper.php(187): getenv(Array)
#2 /opt/librenms/app/Http/Middleware/HandleCors.php(52): LibreNMS\\Util\\EnvHelper::parseArray(Array)
#3 [internal function]: App\\Http\\Middleware\\HandleCors->__construct(Object(App\\Application))
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(845): ReflectionClass->newInstanceArgs(Array)
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build('App\\\\Http\\\\Middle...')
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('App\\\\Http\\\\Middle...', Array, true)
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('App\\\\Http\\\\Middle...', Array)
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('App\\\\Http\\\\Middle...', Array)
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(204): Illuminate\\Foundation\\Application->make('App\\\\Http\\\\Middle...')
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(178): Illuminate\\Foundation\\Http\\Kernel->terminateMiddleware(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#11 /opt/librenms/html/index.php(58): Illuminate\\Foundation\\Http\\Kernel->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#12 {main}
"} 

Was it supposed to remove the ./LibreNMS/Util/Env.php file for the update? That one disappeared, but came back after discarding the commit.

Yes, that is part of the commit.

Try again now, I updated the PR.

@murrant looks good! Back in business!

Since we have updates running as a cron task around midnight, would you recommend we leave this commit until the end of the day, and remove it towards the end of the day?

I merged it now, thanks for testing.

Remove the changes and run ./daily.sh and you should to go.

Awesome, thanks for the quick action Tony!

Cheers!

1 Like

A post was split to a new topic: Device custom links broken