gitviola / ynab-bank-importer

💰 Pull transactions from your bank and import them to YNAB automatically.
https://ynab.com/referral/?ref=C-_IP8eD8dWYfEec&utm_source=customer_referral
MIT License
133 stars 20 forks source link

Connection refused http.rb:939:in #50

Open hahaa24 opened 5 years ago

hahaa24 commented 5 years ago

I installed everything needed to run on an Ubuntu 18.04 LTS container.

I used this command for all the tools needed: sudo apt install git autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev ruby-all-dev libcurl4-openssl-dev ruby-bundler -y

Then I installed Ruby and everything else using this set of commands: git clone https://github.com/rbenv/rbenv.git ~/.rbenv; echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc; echo 'eval "$(rbenv init -)"' >> ~/.bashrc; source ~/.bashrc; type rbenv; git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build; rbenv install 2.5.0;

Then I cloned the git files, did the bundle install and created this config:

---
ynab:
  access_token: "bc69ca9******"
  budget_id: "998*****"
  cash_account_id: # (optional)
accounts:
  - dumper: :fints
    iban: "DE28*****"
    ynab_id: "20*****"
    fints_endpoint: "banking-by7.s-fints-pt-by.de"
    fints_blz: "79****"
    username: "04******"
    password: "f*****"

When I do ruby run.rb, I get this error:

> Traceback (most recent call last):
    20: from run.rb:9:in `<main>'
    19: from run.rb:9:in `map'
    18: from run.rb:11:in `block in <main>'
    17: from /home/linux/ynab-bank-importer/lib/account.rb:18:in `fetch_transactions'
    16: from /home/linux/ynab-bank-importer/lib/dumper/fints.rb:21:in `fetch_transactions'
    15: from /var/lib/gems/2.5.0/gems/ruby_fints-0.0.3/lib/fints/client.rb:19:in `get_sepa_accounts'
    14: from /var/lib/gems/2.5.0/gems/ruby_fints-0.0.3/lib/fints/dialog.rb:39:in `sync'
    13: from /var/lib/gems/2.5.0/gems/ruby_fints-0.0.3/lib/fints/dialog.rb:81:in `send_msg'
    12: from /var/lib/gems/2.5.0/gems/ruby_fints-0.0.3/lib/fints/https_connection.rb:11:in `send_msg'
    11: from /var/lib/gems/2.5.0/gems/httparty-0.16.3/lib/httparty.rb:624:in `post'
    10: from /var/lib/gems/2.5.0/gems/httparty-0.16.3/lib/httparty.rb:507:in `post'
     9: from /var/lib/gems/2.5.0/gems/httparty-0.16.3/lib/httparty.rb:573:in `perform_request'
     8: from /var/lib/gems/2.5.0/gems/httparty-0.16.3/lib/httparty/request.rb:145:in `perform'
     7: from /usr/lib/ruby/2.5.0/net/http.rb:1455:in `request'
     6: from /usr/lib/ruby/2.5.0/net/http.rb:909:in `start'
     5: from /usr/lib/ruby/2.5.0/net/http.rb:920:in `do_start'
     4: from /usr/lib/ruby/2.5.0/net/http.rb:935:in `connect'
     3: from /usr/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
     2: from /usr/lib/ruby/2.5.0/timeout.rb:93:in `block in timeout'
     1: from /usr/lib/ruby/2.5.0/net/http.rb:936:in `block in connect'
/usr/lib/ruby/2.5.0/net/http.rb:939:in `rescue in block in connect': Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80) (Errno::ECONNREFUSED)

I dont know what this Error means, If you need more information, please let me know. Maybe this error occur, because I do not use it on rasbian, but on ubuntu instead. I also use a pihole in my network, it would be possible, that it blocks something of the script, idk. I am not a programmer nor a linux expert, so please be patient. If I get this working, I can provide the complete install manual so others can install it on ubuntu too.

gitviola commented 5 years ago

Hi @hahaa24, could you give it an other try with the following endpoint?

fints_endpoint: "https://banking-by7.s-fints-pt-by.de/fints30"

hahaa24 commented 5 years ago

That seems to be the solution, it loads a bit longer but then says account must be formatted as a uuid and this 60 times. Is this a known error?

gitviola commented 5 years ago

It sounds a bit like either your ynab_id or budget_id is wrong. Do you mind double checking? In case it still happens, can you also post the stracktrace please?

hahaa24 commented 5 years ago

I found the error within my ynab_id I put in something with numbers only I found at my budgets tab. What helped me to find the right id was this: https://github.com/fintech-to-ynab/fintech-to-ynab/wiki/YNAB-Account-ID

Now everything is working just like magic. I think the installation guide is a bit too less detailed for complete amateurs like me. I would agree to make a more detailed guide on how to install your importer on a ubuntu 18.04, if you want to. And thank you very much for the quick help.

hahaa24 commented 5 years ago

Now I try to setup a second account in this config, but then I get an error. I probably only got the formatting wrong. The account is at the same bank and has the same login, only the IBAN differs. (And the ynab_id in the config.

The config:

---
ynab:
  access_token: "bc69ca9******"
  budget_id: "998******"
  cash_account_id: # (optional)
accounts:
  - dumper: :fints
    iban: "DE2879******"
    ynab_id: "ee3e6e******"
    fints_endpoint: "https://banking-by7.s-fints-pt-by.de/fints30"
    fints_blz: "79650000"
    username: "043*********"
    password: "f***"

  - dumper: :fints
    iban: "DE2879*******"
    ynab_id: "14ce3d******"
    fints_endpoint: "https://banking-by7.s-fints-pt-by.de/fints30"
    fints_blz: "79650000"
    username: "043*******"
    password: "f****"

And the error: Traceback (most recent call last): 6: from run.rb:9:in

' 5: from run.rb:9:in map' 4: from run.rb:11:inblock in
' 3: from /home/linux/ynab-bank-importer/lib/account.rb:18:in fetch_transactions' 2: from /home/linux/ynab-bank-importer/lib/dumper/fints.rb:22:infetch_transactions' 1: from /var/lib/gems/2.5.0/gems/ruby_fints-0.0.3/lib/fints/client.rb:50:in get_statement' /var/lib/gems/2.5.0/gems/ruby_fints-0.0.3/lib/fints/client.rb:90:increate_statement_message': undefined method []' for nil:NilClass (NoMethodError)