bnw / firefly-iii-fints-importer

Import financial transactions from you FinTS enabled bank into Firefly III.
GNU Affero General Public License v3.0
151 stars 23 forks source link

Since last week, the imports are broken (APCu fetch fail..) #138

Open Benniphx opened 4 weeks ago

Benniphx commented 4 weeks ago

Hi, I have some config files, and they used to work all the time. Since some days ago I get this error:

Fatal error: Uncaught AssertionError: APCu fetch failed in /app/PasswordStorage.php:22 Stack trace: #0 /app/PasswordStorage.php(22): assert(false, 'APCu fetch fail...') #1 /app/FinTsFactory.php(27): App\PasswordStorage::get() #2 /app/Login.php(17): App\FinTsFactory::create_from_session(Object(Symfony\Component\HttpFoundation\Session\Session)) #3 /app/index.php(61): App\StepFunction\Login() #4 {main} thrown in /app/PasswordStorage.php on line 22

I use Firefly Version [6.1.19]

and pulled the latest firefly-iii-fints-importer image from docker hub (was auto updated ...) (sha256:aca2e155b41d729a13cd4f145aedacb48deeee8ffe5bab109961321ccf75e9b6 2024-08-15 00:13:41)

Since there is no old version available, what do I have to change?

Also, Manual entering of the data resolved in the same error.

bnw commented 4 weeks ago

Hm, looks lile #119 introduced an error, sorry about that :/ As an immediate workaround, you check out the version from before that merge and build the container yourself. I will try to look into it in the next days. Or maybe @TyrionWarMage has some time? :)

Benniphx commented 4 weeks ago

Here is my image what you can use till there is an official fix (tested, and it is working) benniphx/fireflyiiifintsimporter:issues138 (https://hub.docker.com/repository/docker/benniphx/fireflyiiifintsimporter/general) it is an image based on 8c8063ca71943814a7a92c45e40cee6250ffe02f (https://github.com/bnw/firefly-iii-fints-importer/commit/8c8063ca71943814a7a92c45e40cee6250ffe02f)

TyrionWarMage commented 4 weeks ago

I just tried it myself and i can't reproduce the problem. I figured there could be an issue if running multiple imports in parallel, are you doing this? Are you using automation? The bank_password in your config, is it null, "" or a valid string? @bnw Is it working for you?

Benniphx commented 4 weeks ago
{
  "bank_username": "xxx",
  "bank_password": "xxx",
  "bank_code": "xxx",
  "bank_url": "xxx",
  "bank_2fa": "921",
  "firefly_url": xxx",
  "firefly_access_token": "xxx",
  "skip_transaction_review": "true",
  "__description_regex_comment__": "To disable the regex search & replace of the transaction description, set them to null.",
  "description_regex_match": "/^(Übertrag \\/ Überweisung|Lastschrift \\/ Belastung)(.*)(END-TO-END-REF.*|Karte.*|KFN.*)(Ref\\..*)$/mi",
  "description_regex_replace": "$2 [$1 | $3 | $4]",
  "auto_submit_form_via_js": true,
  "choose_account_automation":
  {
    "bank_account_iban": "xxx",
    "firefly_account_id": "xxx",
    "__from_to_comment__": "The following values will be passed directly into DateTime. Set them to null to choose them manually during the import process.",
    "from": "now - 60 days",
    "to": "now"
  }
}

xxx are all valid strings

the error occurs at the point the app wants the verification per trusted device in my case my iPhone (it is the 2 factor fo my bank)

TyrionWarMage commented 4 weeks ago

I think i found something, but i can not test it, because it only happens with TAN mode that require device selection. Additionally, i think it is not really an issue with APCu, but was existing before, it just did not trigger any problems because it was not asserted.

@Benniphx Can you please try https://github.com/bnw/firefly-iii-fints-importer/pull/139 (https://github.com/TyrionWarMage/firefly-iii-fints-importer/tree/fix/apcu_tan_medium)

@bnw My guess: It seems https://github.com/bnw/firefly-iii-fints-importer/blob/71e68d0f9e10bd0debcab47b5baea9c839a7ef60/app/Choose2FADevice.php#L17 sets the password to something empty, because the request has no bank_password. But this was the same way before: https://github.com/bnw/firefly-iii-fints-importer/blob/8c8063ca71943814a7a92c45e40cee6250ffe02f/app/Choose2FADevice.php#L16 However, due to the session invalidation, we can not simply rely on the PasswordStorage class, as it also uses the session in the non-APCu mode. Therefore, i assume it will work with the proposed change, when running docker/APCu, but not without. In general, i don't see where request->bank_password was supposed to be set when reading from configuration...

The correct fix may involve reading the "current" password from PasswordStorage before the session invalidation and then setting it again, but as i don't understand code here well enough, therefore i have not done that.

Benniphx commented 4 weeks ago

will test it now thx

Benniphx commented 4 weeks ago

Unfortunately, this will not resolve the error. I ran into the same Error.

TyrionWarMage commented 4 weeks ago

Ok, i found another issue. Please give this a try: https://github.com/bnw/firefly-iii-fints-importer/pull/140 https://github.com/TyrionWarMage/firefly-iii-fints-importer/tree/fix/cleanup

Benniphx commented 3 weeks ago

I found some time to check again today and build and tested https://github.com/TyrionWarMage/firefly-iii-fints-importer/tree/fix/cleanup, but the error still exits.

bnw commented 3 weeks ago

For now, I have reset the master branch to before #119. This should remove the error for now.

TyrionWarMage commented 3 weeks ago

@Benniphx I really can not reproduce your issue. Therefore, can you please provide some additional information: