bnw / firefly-iii-fints-importer

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

Exception when rules deletes statement on import #16

Open psistorm opened 4 years ago

psistorm commented 4 years ago

I have some rules to automatically convert withdrawals or deposits between my accounts to the type "transfer". Therefore I convert one statement to transfer and remove the other one to avoid duplicates. This rules causes an exception in the importer and he stops importing which should not be happening in my opinion.

Example:

Account A > (transfers money to) > Account B

Account A has a statement of type withdrawal: I convert this to a transfer Account B has a statement of type deposit: I remove this one to have a correct balance

bnw commented 4 years ago

I see. Could you post the exception that occurs?

N4IR0 commented 3 years ago

I've got the same exception while importing transactions.

Is this something you can fix or should I report this to the Firefly III repository?

Error Report Exception: `FireflyIII\Exceptions\FireflyException` Error message: `Cannot find transaction. Possibly, a rule deleted this transaction after its creation..` Error occurred at `"/var/www/html/app/Api/V1/Controllers/Models/Transaction/StoreController.php" in line 128` in Firefly III Stacktrace: ``` #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): FireflyIII\Api\V1\Controllers\Models\Transaction\StoreController->store() #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction() #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(261): Illuminate\Routing\ControllerDispatcher->dispatch() #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(204): Illuminate\Routing\Route->runController() #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(695): Illuminate\Routing\Route->run() #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}() #6 /var/www/html/app/Api/V1/Controllers/Models/Transaction/StoreController.php(68): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #7 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): FireflyIII\Api\V1\Controllers\Models\Transaction\StoreController->FireflyIII\Api\V1\Controllers\Models\Transaction\{closure}() #8 /var/www/html/app/Api/V1/Controllers/Controller.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #9 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): FireflyIII\Api\V1\Controllers\Controller->FireflyIII\Api\V1\Controllers\{closure}() #10 /var/www/html/app/Http/Middleware/Binder.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #11 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): FireflyIII\Http\Middleware\Binder->handle() #12 /var/www/html/app/Http/Middleware/Authenticate.php(75): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #13 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): FireflyIII\Http\Middleware\Authenticate->handle() #14 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(697): Illuminate\Pipeline\Pipeline->then() #16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(672): Illuminate\Routing\Router->runRouteWithinStack() #17 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\Routing\Router->runRoute() #18 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->dispatchToRoute() #19 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\Routing\Router->dispatch() #20 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}() #21 /var/www/html/app/Http/Middleware/InstallationId.php(52): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #22 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): FireflyIII\Http\Middleware\InstallationId->handle() #23 /var/www/html/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #24 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle() #25 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() #27 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle() #28 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() #30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle() #31 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #32 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle() #33 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #34 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle() #35 /var/www/html/app/Http/Middleware/SecureHeaders.php(51): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #36 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): FireflyIII\Http\Middleware\SecureHeaders->handle() #37 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #38 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then() #39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() #40 /var/www/html/public/index.php(76): Illuminate\Foundation\Http\Kernel->handle() #41 {main} ```
bnw commented 3 years ago

Thanks. I'm not exactly sure why the importer stops after this. Does the importer itself provide any error message?

N4IR0 commented 3 years ago

Yep, here is the error message:

Fatal error: Uncaught GrumpyDictator\FFIIIApiSupport\Exceptions\ApiHttpException: Status code is 500: {"message":"Internal Firefly III Exception: Cannot find transaction. Possibly, a rule deleted this transaction after its creation.","exception":"FireflyIII\\Exceptions\\FireflyException"} in /vendor/firefly-iii/api-support-classes/src/Request/PostTransactionRequest.php:70 Stack trace: #0 /app/TransactionsToFireflySender.php(90): GrumpyDictator\FFIIIApiSupport\Request\PostTransactionRequest->post() #1 /app/index.php(275): App\TransactionsToFireflySender->send_transactions() #2 {main} thrown in /vendor/firefly-iii/api-support-classes/src/Request/PostTransactionRequest.php on line 70

bnw commented 3 years ago

Hm, this is a crash in firefly-iii/api-support-classes. Maybe it sufficies to update this package?
@N4IR0 Could you try this with an updated version? You can update the package by calling composer update firefly-iii/api-support-classes.

N4IR0 commented 3 years ago

Unfortunately updating the packages does not solve the problem. I've now created a bug report in the Firefly III repository (https://github.com/firefly-iii/firefly-iii/issues/5177).