wesselt / bunq2ynab

Upload bunq transactions to ynab
Other
72 stars 18 forks source link

Autosync stops working #18

Closed jakob11git closed 4 years ago

jakob11git commented 4 years ago

My autosync used to work just fine for a while, but lately I'm having issues where it seems to hang or rather not receive any callbacks anymore for transactions that have been made. I'm not sure if this issue stems from the script or from bunq, so I decided to report it here first.

For example today I had a direct debit that was automatically approved at around 13:23 and it got synced correctly to YNAB. After that I still seem to be getting callbacks every minute from bunq until 13:28 (I guess that is the 7 times that is mentioned in https://github.com/wesselt/bunq2ynab/issues/5)

screenshot

Unfortunately when I went to the supermarket at 21:08 and made a card transaction, this hasn't been picked up so I need to restart the script. I'd be glad for any advice if it's user error or maybe an idea how this could be handled better.

wesselt commented 4 years ago

Hi Jeyfour,

Thanks for creating this issue.

If the script is run from behind a router, the script tries to set up a UPNP rule to forward Bunq's incoming call. This UPNP rule would be lost if the router were to reset its configuration, perhaps after a reset or a firmware update. This could explain your experience that incoming calls stop arriving.

Where are you running the script?

Kind regards, Wessel

jakob11git commented 4 years ago

Hi Wessel, thank you for the swift answer.

That might indeed be the issue, as I have been relying on UPNP for the port forwarding on my router to work correctly. I disabled the UPNP now and changed the configuration of the router and the script to use a specific port. I'll monitor the situation for the next couple days, and if nothing crops up, will close this issue.

Edit: By the way is there anything I can do against receiving the 7 incoming calls for every transaction? My server is behind a router, but I have a static IP, domain name and valid cert.

wesselt commented 4 years ago

The auto_sync.py script only listens for the tcp connection setup and then breaks off. It isn't a full fledged https endpoint. That means bunq's servers will retry the delivery a number of times.

If you can set up nginx with uwsgi yourself, you could write a proper https endpoint. You can use toggle_callback.py to register the callback with bunq. Then run bunq2ynab.py every time you receive an update from bunq.

jakob11git commented 4 years ago

Thanks Wessel, very helpful. Understanding this better now. As my original problem seems to be resolved now, I'll close this issue.