syncforynab / fintech-to-ynab

Automatically push Monzo and Starling transactions into YNAB in real time.
MIT License
245 stars 137 forks source link

(YNAB::ApiError) #430

Open Rustymage opened 7 months ago

Rustymage commented 7 months ago

Have spun this up and I'm having a little issue. It's running on a docker instance.

The webhook has been registered and succesfully received as per this line:

I, [2023-12-30T18:38:42.773650 #7] INFO -- : Completed 200 OK in 1ms (Views: 0.1ms)

The issue I'm having is the 400 bad request to the YNAB api endpoint.

I, [2023-12-30T18:38:42.773650 #7]  INFO -- : Completed 200 OK in 1ms (Views: 0.1ms)
D, [2023-12-30T18:38:42.877115 #7] DEBUG -- : ETHON: performed EASY effective_url=https://api.youneedabudget.com/v1/budgets/{YNAB_BUDGET_ID}/transactions response_code=0 return_code=ssl_cacert total_time=0.21707299999999996
E, [2023-12-30T18:38:42.877596 #7] ERROR -- : YNAB::Client.create_transaction failure
E, [2023-12-30T18:38:42.877625 #7] ERROR -- : YNAB::Client.create_transaction Response: 
E, [2023-12-30T18:38:42.877639 #7] ERROR -- : Peer certificate cannot be authenticated with given CA certificates (YNAB::ApiError)
/usr/local/bundle/gems/ynab-1.5.0/lib/ynab/api_client.rb:65:in `call_api'
/usr/local/bundle/gems/ynab-1.5.0/lib/ynab/api/transactions_api.rb:126:in `create_transaction_with_http_info'
/usr/local/bundle/gems/ynab-1.5.0/lib/ynab/api/transactions_api.rb:87:in `create_transaction'
/usr/local/bundle/bundler/gems/f2ynab-3ee8170dd7ec/lib/f2ynab/ynab/client.rb:52:in `create_transaction'
/usr/local/bundle/bundler/gems/f2ynab-3ee8170dd7ec/lib/f2ynab/ynab/transaction_creator.rb:16:in `create'
/usr/local/bundle/bundler/gems/f2ynab-3ee8170dd7ec/lib/f2ynab/webhooks/monzo.rb:53:in `import'
/app/app/controllers/monzo_controller.rb:12:in `receive'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/usr/local/bundle/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/usr/local/bundle/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:132:in `run_callbacks'
/usr/local/bundle/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/usr/local/bundle/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/usr/local/bundle/gems/rack-2.0.6/lib/rack/etag.rb:25:in `call'
/usr/local/bundle/gems/rack-2.0.6/lib/rack/conditional_get.rb:38:in `call'
/usr/local/bundle/gems/rack-2.0.6/lib/rack/head.rb:12:in `call'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/usr/local/bundle/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/usr/local/bundle/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/usr/local/bundle/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/usr/local/bundle/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/usr/local/bundle/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
/usr/local/bundle/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
/usr/local/bundle/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
/usr/local/bundle/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
/usr/local/bundle/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
/usr/local/bundle/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
/usr/local/bundle/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
I, [2023-12-30T18:38:42.877950 #7]  INFO -- : Completed 400 Bad Request in 221ms (Views: 0.2ms)

I wonder if the following (from above) is a problem but my research is struggling - any ideas?

E, [2023-12-30T18:38:42.877596 #7] ERROR -- : YNAB::Client.create_transaction failure
E, [2023-12-30T18:38:42.877625 #7] ERROR -- : YNAB::Client.create_transaction Response: 
E, [2023-12-30T18:38:42.877639 #7] ERROR -- : Peer certificate cannot be authenticated with given CA certificates (YNAB::ApiError)

Thanks in advance!

Rustymage commented 7 months ago

I wonder if it the fact I'm running this with Cloudflare as MITM may be impacting my results - the DNS was setup < 60 minutes ago so perhaps the SSL cert is not created...

scottrobertson commented 7 months ago

Some gems/libraries will likely need to be updated. I unfortunately don't have the time to do this right now though.

Rustymage commented 7 months ago

Thanks - will use baked in YNAB updates for now.