NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.84k stars 13.92k forks source link

modules/firefly-iii: dormant cache prevents updating #346864

Open timhae opened 1 week ago

timhae commented 1 week ago

Describe the bug

it seems like the update script in the current module implementation breaks when there are incompatible files in the cache (/var/lib/firefly-iii/cache). I had the same issue as the person reporting upstream here and was able to fix it by removing the cache dir. The other thing I did was change the artisan commands in the script to the ones given here, not sure if that should be preferred of what is given in the docs here. EDIT: I had to revert the artisan script changes for the secrets to be created so that seems fine, maybe there also is an artisan command to properly clear the cache dir? The error for reference is this:

[2024-10-05 12:48:45] local.DEBUG: reachedLimit()
[2024-10-05 12:48:45] local.DEBUG: Read file in "/nix/store/hgwn5ddhxk7g1y7mbfjcsi1bxi3zzr1r-firefly-iii-6.1.21/storage/framework/cache/error-count.json"
[2024-10-05 12:48:45] local.DEBUG: Now checking limit "5m" {"limit":5,"reset":300}
[2024-10-05 12:48:45] local.DEBUG: Time past for this limit is 3002 seconds, exceeding 300 seconds. Reset to zero.
[2024-10-05 12:48:45] local.DEBUG: Now checking limit "1h" {"limit":15,"reset":3600}
[2024-10-05 12:48:45] local.DEBUG: Time past for this limit is 3631 seconds, exceeding 3600 seconds. Reset to zero.
[2024-10-05 12:48:45] local.DEBUG: Now checking limit "24h" {"limit":15,"reset":86400}
[2024-10-05 12:48:45] local.WARNING: Sent 16 emails in 24h, return true.
[2024-10-05 12:48:45] local.INFO: MailError: reached limit, not sending email.
[2024-10-05 12:48:45] local.ERROR: JSON:API server 'v2' does not exist in config or is not a valid class. {"exception":"[object] 

...

"}

   AssertionError

  JSON:API server 'v2' does not exist in config or is not a valid class.

  at vendor/laravel-json-api/core/src/Core/Server/ServerRepository.php:76
     72▕     private function make(string $name): ServerContract
     73▕     {
     74▕         $class = $this->classes[$name] ?? $this->config()->get("jsonapi.servers.{$name}");
     75▕
  ➜  76▕         assert(
     77▕             !empty($class) && class_exists($class) && is_a($class, ServerContract::class, true),
     78▕             "JSON:API server '{$name}' does not exist in config or is not a valid class.",
     79▕         );
     80▕

      +4 vendor frames

  5   routes/api.php:243
      Illuminate\Support\Facades\Facade::__callStatic("server")
      +4 vendor frames

  10  app/Providers/RouteServiceProvider.php:46
      Illuminate\Routing\RouteRegistrar::group("/nix/store/hgwn5ddhxk7g1y7mbfjcsi1bxi3zzr1r-firefly-iii-6.1.21/routes/api.php")

Steps To Reproduce

Steps to reproduce the behavior:

  1. run firefly-iii in an old version (in my case 6.1.19)
  2. update flake lock so you get a new version (e.g. 6.1.21)

Expected behavior

firefly-iii-setup-service runs without errors

Notify maintainers

@savyajha @PatrickDaG @italoaa FYI

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.53, NixOS, 24.11 (Vicuna), 24.11.20241004.bc947f5`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.8`
 - nixpkgs: `/nix/store/sdzpqjwx7pdx6lsq6llyfqqf7hspp83c-source`

Add a :+1: reaction to issues you find important.

savyajha commented 1 week ago

@timhae This has been reported before and, for right now, I'd just recommend clearing the cache as mentioned in this bug report, which you've already done. I will change the maintenance script to do it manually the next time I push a firefly-iii update. :)

Let's keep this bug open till then just to track this issue.

For anyone else who stumbles across this issue, just run rm /var/lib/firefly-iii/cache/config.php and it should work.