wesselt / bunq2ynab

Upload bunq transactions to ynab
Other
78 stars 22 forks source link

No Sync #64

Closed Stonewall6165 closed 7 months ago

Stonewall6165 commented 7 months ago

Hi, after setting it up and updating the config, it didn't sync.

Here is the Log:

START RequestId: c26e4114-f239-4e0a-bc08-22700206444b Version: $LATEST 2024-04-14 19:42:06,761 | INFO | config.py:91 | read_ssm_config | Reading config from SSM 2024-04-14 19:42:08,379 | INFO | credentials.py:1147 | load | Found credentials in environment variables. 2024-04-14 19:42:08,879 | INFO | lambda_function.py:25 | get_iban_from_event | No request body found 2024-04-14 19:42:08,879 | INFO | sync.py:65 | populate | Retrieving bunq accounts... 2024-04-14 19:42:08,879 | INFO | state.py:32 | load | Fetching SSM state bunq2ynab-state 2024-04-14 19:42:09,662 | INFO | sync.py:68 | populate | Retrieving ynab accounts... 2024-04-14 19:42:10,119 | WARNING | sync.py:96 | populate | No matches for rule "*" - "asd" to "asd " - "asd". 2024-04-14 19:42:10,120 | INFO | lambda_function.py:13 | add_callbacks | SSM callback = "https://ixswpdedn1.execute-api.eu-central-1.amazonaws.com/bunq2ynab-lambda" 2024-04-14 19:42:10,120 | INFO | lambda_function.py:16 | add_callbacks | Adding callbacks... END RequestId: c26e4114-f239-4e0a-bc08-22700206444b REPORT RequestId: c26e4114-f239-4e0a-bc08-22700206444b Duration: 3362.23 ms Billed Duration: 3363 ms Memory Size: 512 MB Max Memory Used: 97 MB Init Duration: 633.23 ms

wesselt commented 7 months ago

Hi Stonewall6165, I notice:

2024-04-14 19:42:10,119 | WARNING | sync.py:96 | populate | No matches for rule "*" - "asd" to "asd " - "asd".

That may be the pagination problem, where the account you're looking for is not in the first page of accounts.

How does the solution from this issue work for you? https://github.com/wesselt/bunq2ynab/issues/53

Stonewall6165 commented 7 months ago

I don't find the funktion. Where can i change it?

wesselt commented 7 months ago

It should be in lib/bunq_api.py

Stonewall6165 commented 7 months ago

Sadly no:

Test Event Name (unsaved) test event

Response { "errorMessage": "Syntax error in module 'lambda_function': unindent does not match any outer indentation level (bunq.py, line 111)", "errorType": "Runtime.UserCodeSyntaxError", "requestId": "a84ff84a-14b8-4d66-bf69-612ac9a3b3cb", "stackTrace": [ " File \"/var/task/lib/bunq.py\" Line 111\n for d in bunq.get(method):\n" ] }

Function Logs START RequestId: a84ff84a-14b8-4d66-bf69-612ac9a3b3cb Version: $LATEST LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html [ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'lambda_function': unindent does not match any outer indentation level (bunq.py, line 111) Traceback (most recent call last):   File "/var/task/lib/bunq.py" Line 111         for d in bunq.get(method):END RequestId: a84ff84a-14b8-4d66-bf69-612ac9a3b3cb REPORT RequestId: a84ff84a-14b8-4d66-bf69-612ac9a3b3cb Duration: 4.76 ms Billed Duration: 5 ms Memory Size: 512 MB Max Memory Used: 57 MB Init Duration: 423.40 ms

Request ID a84ff84a-14b8-4d66-bf69-612ac9a3b3cb

wesselt commented 7 months ago

" unindent does not match any outer indentation level " --> Python is very sensitive about whitespace on front of the line. It is also very specific about whether you use a tab or a space.

What change did you make to lib/bunq.py" Line 111 ?

Stonewall6165 commented 7 months ago

I Copyd the Code and add the count 100.

I get this Error:

Response { "statusCode": 500, "body": "Traceback (most recent call last):\n File \"/var/task/lambda_function.py\", line 51, in lambda_handler\n sync.populate()\n File \"/var/task/lib/sync.py\", line 66, in populate\n self.bunq_accounts = [a for a in bunq_api.get_accounts()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/var/task/lib/bunq_api.py\", line 131, in get_accounts\n yield from get_accounts_for_user(u)\n File \"/var/task/lib/bunq_api.py\", line 111, in get_accounts_for_user\n for d in bunq.get(method):\n ^^^^^^^^^^^^^^^^\n File \"/var/task/lib/bunq.py\", line 225, in get\n raise Exception(\"Internal error: call to bunq.get() with count \"\nException: Internal error: call to bunq.get() with count argument. Call fetch() instead. Method: v1/user/1230349/monetary-account?count=100\n" }

Function Logs START RequestId: 336b2cae-d95a-4c37-8380-630d4fa944e4 Version: $LATEST 2024-04-16 17:20:22,656 | INFO | config.py:91 | read_ssm_config | Reading config from SSM 2024-04-16 17:20:24,258 | INFO | credentials.py:1147 | load | Found credentials in environment variables. 2024-04-16 17:20:24,745 | INFO | lambda_function.py:25 | get_iban_from_event | No request body found 2024-04-16 17:20:24,745 | INFO | sync.py:65 | populate | Retrieving bunq accounts... 2024-04-16 17:20:24,745 | INFO | state.py:32 | load | Fetching SSM state bunq2ynab-state 2024-04-16 17:20:24,996 | ERROR | lambda_function.py:62 | lambda_handler | Exception occurred Traceback (most recent call last): File "/var/task/lambda_function.py", line 51, in lambda_handler sync.populate() File "/var/task/lib/sync.py", line 66, in populate self.bunq_accounts = [a for a in bunq_api.get_accounts() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/task/lib/bunq_api.py", line 131, in get_accounts yield from get_accounts_for_user(u) File "/var/task/lib/bunq_api.py", line 111, in get_accounts_for_user for d in bunq.get(method): ^^^^^^^^^^^^^^^^ File "/var/task/lib/bunq.py", line 225, in get raise Exception("Internal error: call to bunq.get() with count " Exception: Internal error: call to bunq.get() with count argument. Call fetch() instead. Method: v1/user/1230349/monetary-account?count=100 END RequestId: 336b2cae-d95a-4c37-8380-630d4fa944e4 REPORT RequestId: 336b2cae-d95a-4c37-8380-630d4fa944e4 Duration: 2343.85 ms Billed Duration: 2344 ms Memory Size: 512 MB Max Memory Used: 96 MB Init Duration: 621.31 ms

When i delete the count100 it is the old Error.

wesselt commented 7 months ago

Oh, that's surprising, it looks like you're on a much newer version than I thought. Your version uses the maximum count by itself and raises an error if you specify it.

Let's go back to the original problem:

No matches for rule "*" - "asd" to "asd " - "asd".

There's an extra space after the second "asd ". Investigate your configuration, and double check the accounts section in your configuration for extra spaces. How well do the names match with what YNAB and bunq show?

Stonewall6165 commented 7 months ago

The name is different, but all three are the same. i deleted the extra space, but it is the same error.

I copied all Files from this Repro, thats why i have the newest versions

wesselt commented 7 months ago

Hmm. How about enabling debug logging? That produces massive output but contains the required information.

You can set the environment variable "LOG_LEVEL" to "debug", or in the JSON configuration, the setting "log-level" to "debug".

Stonewall6165 commented 7 months ago

i tried the other Version on AWS from bunq2ynab and that worked well.

wesselt commented 7 months ago

Cheers!