When accessing the configuration in the Admin menu an "Unknown error "appears and when running it via CLI, following stacktrace can be seen:
$ php7.4 flarum mercury:update-check
PHP Fatal error: Uncaught Error: Call to a member function setAttribute() on null in /var/www/flarum/vendor/extiverse/api-client/src/Flarum/UpdatesChecker.php:27
Stack trace:
#0 /var/www/flarum/vendor/extiverse/mercury/src/Console/Command/CheckingUpdatesCommand.php(32): Extiverse\Api\Flarum\UpdatesChecker->core()
#1 /var/www/flarum/vendor/illuminate/container/BoundMethod.php(36): Extiverse\Mercury\Console\Command\CheckingUpdatesCommand->handle()
#2 /var/www/flarum/vendor/illuminate/container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#3 /var/www/flarum/vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#4 /var/www/flarum/vendor/illuminate/container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#5 /var/custom in /var/www/flarum/vendor/extiverse/api-client/src/Flarum/UpdatesChecker.php on line 27
And when accessing the web configuration, I can see following in the flarum logs:
[2021-06-26 12:33:07] flarum.ERROR: Error: Call to a member function setAttribute() on null in /var/www/flarum/vendor/extiverse/api-client/src/Flarum/UpdatesChecker.php:27
Stack trace:
#0 /var/www/flarum/vendor/extiverse/mercury/src/Api/Controller/ExtensionsUpdatesController.php(27): Extiverse\Api\Flarum\UpdatesChecker->core()
#1 /var/www/flarum/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Extiverse\Mercury\Api\Controller\ExtensionsUpdatesController->handle()
#2 /var/www/flarum/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}()
#3 /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ExecuteRoute->process()
#4 /var/www/flarum/vendor/kilowhat/flarum-ext-audit-free/src/Middlewares/SetLoggerActor.php(28): Laminas\Stratigility\Next->handle()
#5 /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Kilowhat\Audit\Middlewares\SetLoggerActor->process()
#6 /var/www/flarum/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle()
#7 /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Api\Middleware\ThrottleApi->process()
#8 /var/www/flarum/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(36): Laminas\Stratigility\Next->handle()
#9 /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\CheckCsrfToken->process()
#10 /var/www/flarum/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(67): Laminas\Stratigility\Next->handle()
[...]
The relevant code piece in UpdatesChecker.php
is:
Which is:
25 /** @var Extension $core */
26 $core = $response->getData();
27 $core->setAttribute('current-version', Application::VERSION);
What I did:
- Installed mercury
- Set the token
- Run the CLI, directly facing the stacktrace