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

[Bug]: API intermittently fails to open budget with automated transaction imports #2338

Closed
3 of 5 tasks
spenco100 opened this issue Feb 7, 2024 · 2 comments
Closed
3 of 5 tasks
Labels
bug Something isn't working

Comments

@spenco100
Copy link

Verified issue does not already exist?

  • I have searched and found no existing issue

Is this related to GoCardless, Simplefin or another bank-sync provider?

  • I have checked my server logs and could not see any errors there
  • I will be attaching my server logs to this issue
  • I will be attaching my client-side (browser) logs to this issue
  • I understand that this issue will be automatically closed if insufficient information is provided

What happened?

I have a system where all my cards / bank accounts send transaction alerts to a single mailbox, and a server to monitor that mailbox. I parse details from the emails, add the transactions to a google sheet, and then to my new Actual server (hosted on Fly.io)

Intermittently I see transactions that appear in my Google sheet but not in Actual - and my error logging shows the following error coinciding with the times that transactions were processed in my server.

Server running imports with the Actual API logs show:
Error: We had an unknown problem opening “My-Finances-7172b03”.

Has anyone else had this issue? Is there a better method I am not seeing in the docs, to import transactions? Here is my server config and code.

Node version: 18.12.0
Actual API version (running on my 3rd party server):
"@actual-app/api": "^6.4.0"

Actual server version:
"@actual-app/crdt": "2.1.0"
"@actual-app/web": "24.1.0"

Function calling the Actual API from my server:

const api = require('@actual-app/api');
// Write 1+ transaction to the Actual server
async function writeTransactions(transactions) {
    let result = { error: null, response: null };
    try {
        const actualTransactions = transactions.map(convertTransaction);

        await api.init({
            serverURL: host,
            password: password,
        });

        // load the budget
        await api.downloadBudget(actual_sync_id);

        // sort transactions by card into a larger object
        const transactionsByCard = {};
        actualTransactions.forEach(transaction => {
            const { account } = transaction;
            if (!transactionsByCard[account]) transactionsByCard[account] = [];
            transactionsByCard[account].push(transaction);
        });

        Object.keys(transactionsByCard).forEach(account => {
            api.importTransactions(account, transactionsByCard[account]);
        });

    } catch (e) {
        console.error(e);
        result.error = (typeof e != "string") ? JSON.stringify(e) : e;
    } finally {
        await api.shutdown();
        return result;
    }
};

What error did you receive?

Exception from a finished function: Error: We had an unknown problem opening “My-Finances-7172b03”.

Where are you hosting Actual?

Fly.io

What browsers are you seeing the problem on?

No response

Operating System

Linux

@spenco100 spenco100 added the bug Something isn't working label Feb 7, 2024
@youngcw
Copy link
Member

youngcw commented Feb 8, 2024

The api can be really finicky about node versions. Im on 18.19 and it works fine.

@youngcw
Copy link
Member

youngcw commented Feb 26, 2024

Closing for now unless something else comes up. If you are still having issues I recommend trying a few node versions and see what works.

@youngcw youngcw closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants