Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to sync: date must not be in the future or over 5 years ago #51

Open
MagicLegend opened this issue Feb 17, 2024 · 4 comments
Open

Comments

@MagicLegend
Copy link

MagicLegend commented Feb 17, 2024

Since last night (execution at 1AM last night was the first time this happened), I'm unable to sync my transactions:

ync.py:60 | populate | Retrieving bunq accounts...
2024-02-17 11:44:05,948 | INFO | state.py:32 | load | Fetching SSM state bunq2ynab-state
2024-02-17 11:44:06,036 | INFO | state.py:65 | write_state | Writing SSM state bunq2ynab-state
2024-02-17 11:44:06,132 | INFO | bunq.py:102 | get_session_token | Requesting session token...
2024-02-17 11:44:06,491 | INFO | state.py:65 | write_state | Writing SSM state bunq2ynab-state
2024-02-17 11:44:06,899 | INFO | sync.py:62 | populate | Retrieving ynab accounts...
2024-02-17 11:44:07,344 | INFO | sync.py:158 | synchronize_account | Synching "<bunqName>" - "<mainAccount>" to "<ynabBudget>" - "<mainAccount>"...
2024-02-17 11:44:07,344 | INFO | sync.py:167 | synchronize_account | Reading ynab transactions from 2024-01-13...
2024-02-17 11:44:07,813 | INFO | sync.py:170 | synchronize_account | Retrieved 96 ynab transactions...
2024-02-17 11:44:07,813 | INFO | sync.py:176 | synchronize_account | Reading bunq payments from 2024-02-17...
2024-02-17 11:44:08,595 | INFO | bunq_api.py:151 | get_payments | Retrieved back to 2023-12-09...
2024-02-17 11:44:08,595 | INFO | sync.py:179 | synchronize_account | Retrieved 5 bunq payments...
2024-02-17 11:44:08,596 | INFO | ynab.py:150 | upload_transactions | Creating transactions up to 2024-02-17...
2024-02-17 11:44:09,063 | INFO | sync.py:191 | synchronize_account | "<bunqName>" - "<mainAccount>" to "<ynabBudget>" - "<mainAccount>": Created 2 and patched 0 transactions.
2024-02-17 11:44:09,063 | INFO | sync.py:158 | synchronize_account | Synching "<bunqName>" - "<omeDuo>" to "<ynabBudget>" - "<omeDuo>"...
2024-02-17 11:44:09,063 | INFO | sync.py:167 | synchronize_account | Reading ynab transactions from 2024-01-13...
2024-02-17 11:44:09,993 | INFO | sync.py:170 | synchronize_account | Retrieved 124 ynab transactions...
2024-02-17 11:44:09,994 | INFO | sync.py:176 | synchronize_account | Reading bunq payments from 2023-07-21...
2024-02-17 11:44:11,155 | INFO | bunq_api.py:151 | get_payments | Retrieved back to 2020-05-16...
2024-02-17 11:44:11,172 | INFO | sync.py:179 | synchronize_account | Retrieved 1 bunq payments...
2024-02-17 11:44:11,172 | INFO | sync.py:191 | synchronize_account | "<bunqName>" - "<omeDuo>" to "<ynabBudget>" - "<omeDuo>": Created 0 and patched 0 transactions.
2024-02-17 11:44:11,173 | INFO | sync.py:158 | synchronize_account | Synching "<bunqName>" - "<accountThatDoesntExistAnymore>" to "<ynabBudget>" - "<accountThatDoesntExistAnymore>"...
2024-02-17 11:44:11,173 | INFO | sync.py:167 | synchronize_account | Reading ynab transactions from 2024-01-13...
2024-02-17 11:44:11,997 | INFO | sync.py:170 | synchronize_account | Retrieved 1 ynab transactions...
2024-02-17 11:44:11,997 | INFO | sync.py:176 | synchronize_account | Reading bunq payments from 2000-01-01...
2024-02-17 11:44:13,725 | INFO | bunq_api.py:151 | get_payments | Retrieved back to 2019-01-29...
2024-02-17 11:44:13,725 | INFO | sync.py:179 | synchronize_account | Retrieved 9 bunq payments...
2024-02-17 11:44:13,725 | INFO | ynab.py:150 | upload_transactions | Creating transactions up to 2019-01-29...
2024-02-17 11:44:14,136 | ERROR | lambda_function.py:62 | lambda_handler | Exception occurred
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 55, in lambda_handler
result = sync.synchronize()
File "/var/task/lib/sync.py", line 212, in synchronize
results += self.synchronize_account(syncpair)
File "/var/task/lib/sync.py", line 184, in synchronize_account
created, duplicates, patched = ynab.upload_transactions(
File "/var/task/lib/ynab.py", line 152, in upload_transactions
new_result = post(method, {"transactions": new_batch})
File "/var/task/lib/ynab.py", line 179, in post
return call('POST', method, data)
File "/var/task/lib/ynab.py", line 56, in call
raise Exception("{0} (details: {1})".format(
Exception: bad_request (details: date must not be in the future or over 5 years ago (index: 8))
END RequestId: 4a8ff345-<asdf>2acc18a839e7
REPORT RequestId: 4a8ff345-<asdf>-2acc18a839e7	Duration: 9957.92 ms	Billed Duration: 9958 ms	Memory Size: 512 MB	Max Memory Used: 94 MB	Init Duration: 541.02 ms	

I think I found a limit in the YNAB API that wasn't accounted for :-) <accountThatDoesntExistAnymore> is an old account that I can't find in my Bunq app anymore, since I replaced it with a savings account. I did still have it in YNAB but it was simply empty containing no transactions. When logging at DEBUG level I can see it's trying to create a transaction that happened on 2019-01-29, which is more than five years ago now.

Archiving the account in YNAB did not seem to solve it, it still fails when manually trying to execute the sync.

Any tips on what I could try?

Thanks!

@wesselt
Copy link
Owner

wesselt commented Feb 17, 2024

Hi Magiclegend,

Haha, indeed it looks like YNAB rejects 5 year old transactions. One option is to exclude the offending account from the "accounts" section in your configuration.

I've also added a commit to not go back further than 5 years: ba06874

Kind regards,
Wessel

@MagicLegend
Copy link
Author

Hi Wessel,

Thanks for the quick fix! What would be the best way to get the lambda updated? Or is it automatically the latest version of master when I reinstall the application from the repository?

Thanks!

@wesselt
Copy link
Owner

wesselt commented Feb 19, 2024

Updating the lambda was discussed here: #49

It takes some expertise at AWS which I don't really have. I've been planning to learn it for a few years now 😂

@MagicLegend
Copy link
Author

Gotcha, I see. I also don't have the expertise I'm afraid, I was using this project as an excuse to learn some about it 😄 Let's follow up in #49 about updating the AWS app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants