maybe-finance / maybe

The OS for your personal finances
https://maybe.co
GNU Affero General Public License v3.0
29.34k stars 2.23k forks source link

Bug: "Missing Exchange Rates From Eur To Chf" Error #980

Closed patrontheo closed 1 month ago

patrontheo commented 1 month ago

Describe the bug I'm self-hosting Maybe on docker. I set up my Synth API key as SYNTH_API_KEY in the env file. However if I create an bank account with a different currency from the default one, I get the error message: "Missing Exchange Rates From Eur To Chf". Also, in the dashboard, the net worth includes only the total of the accounts in the main currency, not the other ones.

To Reproduce Steps to reproduce the behavior:

  1. Add an account in a currency different than the default one.
  2. Click on the account.
  3. The error message appears (see image below).

Expected behavior Let's say I have 3 accounts (2 in CHF, the main currency, 1 in EUR), accounts 1 and 2 have respectively 100CHF and 200CHF, account 3 has 300€. I expect my net worth to be ~593CHF (300CHF + 300€ converted to CHF), but I see 300CHF.

Screenshots / Recordings

image

Additional context When I go on my Synthfinance account, I see 0 API calls, so I guess the error is the API call or before.

zachgoll commented 1 month ago

Will take a look at this! Definitely should be seeing some API calls for this.

osaroadade commented 1 month ago

I just updated today and I am facing similar issues with my local currency (NGN) as well.

zachgoll commented 1 month ago

@patrontheo I looked into this and was not able to reproduce locally following the steps provided.

Can you share with me the following so we can diagnose this?

environment:
  GOOD_JOB_EXECUTION_MODE: async
osaroadade commented 1 month ago

@zachgoll I am running the latest version of Maybe and I do have the key in my environment. I just updated again to make sure (attached a screenshot of the new error message asking me to troubleshoot):

image

zachgoll commented 1 month ago

@osaroadade thanks for confirming. Are you also seeing 0 API calls in your Synth dashboard? If so, would you mind adding this to your compose file environment block and restarting the instance?

environment:
  SYNTH_API_KEY: ${SYNTH_API_KEY}
osaroadade commented 1 month ago

Soooo... I think I just bricked my local setup. I decided to get rid of all my containers and perform a new pull, with the assumption that my local data would be "safe", but it wasn't and I think I might have to start all over again.

When creating a new account the input labels all say true:

image

I was able to test it though and it works. I can see that an API call was made on my Synth dashboard, and it also shows the equivalent as well.

image

Thanks!

zachgoll commented 1 month ago

@osaroadade great to hear that the exchange rates are working now. I think the issue may have been the app not properly reading the SYNTH_API_KEY in the compose configuration.

In regards to lost data—when you dropped the containers, did you also drop your volumes? It should be perfectly safe to re-pull and restart the container, but if you removed the volumes too, that would be a loss of data.

If you have used the example compose file configuration, you should be able to inspect the Postgres volume to see where it is mapped on your host machine:

docker volume inspect maybe_postgres-data:

[
    {
        "CreatedAt": "2024-07-01T16:29:14Z",
        "Driver": "local",
        "Labels": {
            "com.docker.compose.project": "maybe",
            "com.docker.compose.version": "2.27.1",
            "com.docker.compose.volume": "postgres-data"
        },
        "Mountpoint": "/var/lib/docker/volumes/maybe_postgres-data/_data",
        "Name": "maybe_postgres-data",
        "Options": null,
        "Scope": "local"
    }
]
osaroadade commented 1 month ago

I dropped the volumes as well. That's goodbye to all the work done so far.

I'll just start afresh again. Hopefully, I get to find new bugs or quality of life improvements to share.

Thanks!

zachgoll commented 1 month ago

@osaroadade bummer! Hopefully starting fresh uncovers some good improvements we can make. Appreciate you helping debug this one. In the future, we should have an "import/export" Maybe data flow that should help self-hosters backup their data periodically. Not quite there yet though!

I'm going to close this out as I believe this bug was caused by earlier versions of Maybe.

For those stumbling upon this issue in the future, here is the FIX:

# docker-compose.yml

# ... other configuration blocks 

app:
  environment:
    GOOD_JOB_EXECUTION_MODE: async
    SYNTH_API_KEY: ${SYNTH_API_KEY} # will load it from .env file
patrontheo commented 1 month ago

I added SYNTH_API_KEY: ${SYNTH_API_KEY} and pulled and it now works. Thanks !