arkaitzgarro / elastic-apm-laravel

Laravel APM agent for Elastic v2 intake API
MIT License
79 stars 17 forks source link

Build failing due to failure in the Command collector #163

Closed dpkaraivanov closed 2 years ago

dpkaraivanov commented 2 years ago

While running the automatic build in the repository of my project after running composer install, I encounter the following error:

[2022-06-20 15:19:24] production.ERROR: Trying to access array offset on value of type bool {"exception":"[object] (ErrorException(code: 0): Trying to access array offset on value of type bool at /frontend/vendor/arkaitzgarro/elastic-apm-laravel/src/Collectors/CommandCollector.php:103)
[stacktrace]
#0 /frontend/vendor/arkaitzgarro/elastic-apm-laravel/src/Collectors/CommandCollector.php(103): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Trying to acces...', '/frontend/vendo...', 103, Array)
#1 /frontend/vendor/arkaitzgarro/elastic-apm-laravel/src/Collectors/CommandCollector.php(32): AG\\ElasticApmLaravel\\Collectors\\CommandCollector->addMetadata(Object(Nipwaayoni\\Events\\Transaction))
#2 /frontend/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(381): AG\\ElasticApmLaravel\\Collectors\\CommandCollector->AG\\ElasticApmLaravel\\Collectors\\{closure}(Object(Illuminate\\Console\\Events\\CommandStarting))
#3 /frontend/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(226): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}('Illuminate\\\\Cons...', Array)
#4 /frontend/vendor/laravel/framework/src/Illuminate/Console/Application.php(89): Illuminate\\Events\\Dispatcher->dispatch('Illuminate\\\\Cons...')
#5 /frontend/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#6 /frontend/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#7 {main}
"} 

In CommandCollector.php line 103:

  Trying to access array offset on value of type bool  

Everything was working fine until last week (last successful release was on thursday) and today out of nowhere it crashes.

arkaitzgarro commented 2 years ago

We didn’t make any change in this package in very long time.

Can you check the output of this command on your CI environment?

$runner = posix_getpwuid(posix_geteuid())['name'];

dpkaraivanov commented 2 years ago

It's returning false

arkaitzgarro commented 2 years ago

Are you sure nothing changed on your environment? posix_getpwuid(posix_geteuid()) will only return false in case of failure.