[GH-ISSUE #1585] [Bug]: importTransactions results in timestamp error #7532

Closed
opened 2026-04-10 17:24:15 -05:00 by GiteaMirror · 17 comments
Owner

Originally created by @niko123456000 on GitHub (Aug 25, 2023).
Original GitHub issue: https://github.com/actualbudget/actual/issues/1585

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

Attempting to insert a transaction using the API results in an error.

var api = require('@actual-app/api');
api.init({
  serverURL: '',
  password: ''
});

api.importTransactions(accountId, [{
    account_id: accountId,
    date: "2024-08-23",
    amount: 1200,
    payee: "Kroger"
  }])

Node.js: v20.5.1 on WSL2
Client version: v23.8.1
Server version: v23.8.1

What error did you receive?

/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:31964
                        let latestTimestamp = (0, _actual_app_crdt__WEBPACK_IMPORTED_MODULE_0__.getClock)().timestamp.toString();
                                                                                                           ^

TypeError: Cannot read properties of undefined (reading 'timestamp')
    at undoDisabled (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:31964:108)
    at _runMutator (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:41044:24)
    at run (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:44421:45)
    at sequenceState.queue.push.resolve.resolve (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:44433:36)
    at new Promise (<anonymous>)
    at /home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:44432:32
    at /home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:31963:83
    at runHandler (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:41028:31)
    at Object.send (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:40685:92)
    at send (/home/nicholas/app/node_modules/@actual-app/api/dist/methods.js:34:21)

Node.js v20.5.1

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

No response

Operating System

Linux

Originally created by @niko123456000 on GitHub (Aug 25, 2023). Original GitHub issue: https://github.com/actualbudget/actual/issues/1585 ### Verified issue does not already exist? - [X] I have searched and found no existing issue ### What happened? Attempting to insert a transaction using the API results in an error. ``` var api = require('@actual-app/api'); api.init({ serverURL: '', password: '' }); api.importTransactions(accountId, [{ account_id: accountId, date: "2024-08-23", amount: 1200, payee: "Kroger" }]) ``` Node.js: v20.5.1 on WSL2 Client version: v23.8.1 Server version: v23.8.1 ### What error did you receive? ``` /home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:31964 let latestTimestamp = (0, _actual_app_crdt__WEBPACK_IMPORTED_MODULE_0__.getClock)().timestamp.toString(); ^ TypeError: Cannot read properties of undefined (reading 'timestamp') at undoDisabled (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:31964:108) at _runMutator (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:41044:24) at run (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:44421:45) at sequenceState.queue.push.resolve.resolve (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:44433:36) at new Promise (<anonymous>) at /home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:44432:32 at /home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:31963:83 at runHandler (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:41028:31) at Object.send (/home/nicholas/app/node_modules/@actual-app/api/dist/app/bundle.api.js:40685:92) at send (/home/nicholas/app/node_modules/@actual-app/api/dist/methods.js:34:21) Node.js v20.5.1 ``` ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? _No response_ ### Operating System Linux
GiteaMirror added the bugAPI labels 2026-04-10 17:24:15 -05:00
Author
Owner

@MatissJanis commented on GitHub (Aug 26, 2023):

What API version are you using? I just tested against a local instance and also a remote instance. Both worked perfectly fine.

var api = require('@actual-app/api');

const config = {
    serverURL: 'http://localhost:5006',
    password: 'password',
    budgetId: '4e805261-6fdc-4c50-b5f3-fa34876644c8',
    accountId: '76d2ed74-c606-41c2-8f5d-f18a6f99cadc',
};


(async () => {
    await api.init(config);
    await api.downloadBudget(config.budgetId);

    await api.importTransactions(config.accountId, [{
        date: "2024-08-23",
        amount: 1200,
        payee_name: "Kroger"
    }]);

    let budget = await api.getBudgetMonth('2023-08');
    console.log(budget);

    await api.shutdown();
})();
<!-- gh-comment-id:1694229651 --> @MatissJanis commented on GitHub (Aug 26, 2023): What API version are you using? I just tested against a local instance and also a remote instance. Both worked perfectly fine. ```javascript var api = require('@actual-app/api'); const config = { serverURL: 'http://localhost:5006', password: 'password', budgetId: '4e805261-6fdc-4c50-b5f3-fa34876644c8', accountId: '76d2ed74-c606-41c2-8f5d-f18a6f99cadc', }; (async () => { await api.init(config); await api.downloadBudget(config.budgetId); await api.importTransactions(config.accountId, [{ date: "2024-08-23", amount: 1200, payee_name: "Kroger" }]); let budget = await api.getBudgetMonth('2023-08'); console.log(budget); await api.shutdown(); })(); ```
Author
Owner

@niko123456000 commented on GitHub (Aug 26, 2023):

How can I determine the version? It is the version downloaded via "npm
install @actual-app/api".

I attempted your code just now and got an error "Segmentation fault".

Can I also double-check, is the accountId the string after
"http://server:port/accounts/" when you navigate to an account?

On Sat, 26 Aug 2023 at 18:39, Matiss Janis Aboltins <
@.***> wrote:

What API version are you using? I just tested against a local instance and
also a remote instance. Both worked perfectly fine.

var api = @.***/api');
const config = {
serverURL: 'http://localhost:5006',
password: 'password',
budgetId: '4e805261-6fdc-4c50-b5f3-fa34876644c8',
accountId: '76d2ed74-c606-41c2-8f5d-f18a6f99cadc',};

(async () => {
await api.init(config);
await api.downloadBudget(config.budgetId);

await api.importTransactions(config.accountId, [{
    date: "2024-08-23",
    amount: 1200,
    payee: "Kroger"
}]);

let budget = await api.getBudgetMonth('2023-08');
console.log(budget);

await api.shutdown();})();


Reply to this email directly, view it on GitHub
https://github.com/actualbudget/actual/issues/1585#issuecomment-1694229651,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AE2HTLHQLGKZ6A7IQH4IMYDXXGY3ZANCNFSM6AAAAAA36FFT7M
.
You are receiving this because you authored the thread.Message ID:
@.***>

<!-- gh-comment-id:1694242010 --> @niko123456000 commented on GitHub (Aug 26, 2023): How can I determine the version? It is the version downloaded via "npm install @actual-app/api". I attempted your code just now and got an error "Segmentation fault". Can I also double-check, is the accountId the string after "http://server:port/accounts/" when you navigate to an account? On Sat, 26 Aug 2023 at 18:39, Matiss Janis Aboltins < ***@***.***> wrote: > What API version are you using? I just tested against a local instance and > also a remote instance. Both worked perfectly fine. > > var api = ***@***.***/api'); > const config = { > serverURL: 'http://localhost:5006', > password: 'password', > budgetId: '4e805261-6fdc-4c50-b5f3-fa34876644c8', > accountId: '76d2ed74-c606-41c2-8f5d-f18a6f99cadc',}; > > (async () => { > await api.init(config); > await api.downloadBudget(config.budgetId); > > await api.importTransactions(config.accountId, [{ > date: "2024-08-23", > amount: 1200, > payee: "Kroger" > }]); > > let budget = await api.getBudgetMonth('2023-08'); > console.log(budget); > > await api.shutdown();})(); > > — > Reply to this email directly, view it on GitHub > <https://github.com/actualbudget/actual/issues/1585#issuecomment-1694229651>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AE2HTLHQLGKZ6A7IQH4IMYDXXGY3ZANCNFSM6AAAAAA36FFT7M> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
Author
Owner

@niko123456000 commented on GitHub (Aug 26, 2023):

The api version is 9.8.0

$ npm -v actual-app/api
9.8.0

On Sat, 26 Aug 2023 at 19:31, Nicholas Manojlovic <
@.***> wrote:

How can I determine the version? It is the version downloaded via "npm
install @actual-app/api".

I attempted your code just now and got an error "Segmentation fault".

Can I also double-check, is the accountId the string after
"http://server:port/accounts/" when you navigate to an account?

On Sat, 26 Aug 2023 at 18:39, Matiss Janis Aboltins <
@.***> wrote:

What API version are you using? I just tested against a local instance
and also a remote instance. Both worked perfectly fine.

var api = @.***/api');
const config = {
serverURL: 'http://localhost:5006',
password: 'password',
budgetId: '4e805261-6fdc-4c50-b5f3-fa34876644c8',
accountId: '76d2ed74-c606-41c2-8f5d-f18a6f99cadc',};

(async () => {
await api.init(config);
await api.downloadBudget(config.budgetId);

await api.importTransactions(config.accountId, [{
    date: "2024-08-23",
    amount: 1200,
    payee: "Kroger"
}]);

let budget = await api.getBudgetMonth('2023-08');
console.log(budget);

await api.shutdown();})();


Reply to this email directly, view it on GitHub
https://github.com/actualbudget/actual/issues/1585#issuecomment-1694229651,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AE2HTLHQLGKZ6A7IQH4IMYDXXGY3ZANCNFSM6AAAAAA36FFT7M
.
You are receiving this because you authored the thread.Message ID:
@.***>

<!-- gh-comment-id:1694242606 --> @niko123456000 commented on GitHub (Aug 26, 2023): The api version is 9.8.0 $ npm -v actual-app/api 9.8.0 On Sat, 26 Aug 2023 at 19:31, Nicholas Manojlovic < ***@***.***> wrote: > How can I determine the version? It is the version downloaded via "npm > install @actual-app/api". > > I attempted your code just now and got an error "Segmentation fault". > > Can I also double-check, is the accountId the string after > "http://server:port/accounts/" when you navigate to an account? > > > On Sat, 26 Aug 2023 at 18:39, Matiss Janis Aboltins < > ***@***.***> wrote: > >> What API version are you using? I just tested against a local instance >> and also a remote instance. Both worked perfectly fine. >> >> var api = ***@***.***/api'); >> const config = { >> serverURL: 'http://localhost:5006', >> password: 'password', >> budgetId: '4e805261-6fdc-4c50-b5f3-fa34876644c8', >> accountId: '76d2ed74-c606-41c2-8f5d-f18a6f99cadc',}; >> >> (async () => { >> await api.init(config); >> await api.downloadBudget(config.budgetId); >> >> await api.importTransactions(config.accountId, [{ >> date: "2024-08-23", >> amount: 1200, >> payee: "Kroger" >> }]); >> >> let budget = await api.getBudgetMonth('2023-08'); >> console.log(budget); >> >> await api.shutdown();})(); >> >> — >> Reply to this email directly, view it on GitHub >> <https://github.com/actualbudget/actual/issues/1585#issuecomment-1694229651>, >> or unsubscribe >> <https://github.com/notifications/unsubscribe-auth/AE2HTLHQLGKZ6A7IQH4IMYDXXGY3ZANCNFSM6AAAAAA36FFT7M> >> . >> You are receiving this because you authored the thread.Message ID: >> ***@***.***> >> >
Author
Owner

@MatissJanis commented on GitHub (Aug 26, 2023):

The latest version is 6.2.1 🤔

https://www.npmjs.com/package/@actual-app/api?activeTab=versions

<!-- gh-comment-id:1694243570 --> @MatissJanis commented on GitHub (Aug 26, 2023): The latest version is 6.2.1 🤔 https://www.npmjs.com/package/@actual-app/api?activeTab=versions
Author
Owner

@niko123456000 commented on GitHub (Aug 26, 2023):

oh sorry, that was my mistake - it was just giving me the version of npm I
think.

$ npm list
nicholas@ /home/nicholas
├── @actual-app/api@6.2.1
├── bundle@2.1.0
├── express@4.18.2
├── webpack@5.88.2
└── yarn@1.22.19

On Sat, 26 Aug 2023 at 19:39, Matiss Janis Aboltins <
@.***> wrote:

The latest version is 6.2.1 🤔

@.***/api?activeTab=versions


Reply to this email directly, view it on GitHub
https://github.com/actualbudget/actual/issues/1585#issuecomment-1694243570,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AE2HTLFY2A7LBVNAY6Z75DDXXG73XANCNFSM6AAAAAA36FFT7M
.
You are receiving this because you authored the thread.Message ID:
@.***>

<!-- gh-comment-id:1694245832 --> @niko123456000 commented on GitHub (Aug 26, 2023): oh sorry, that was my mistake - it was just giving me the version of npm I think. $ npm list nicholas@ /home/nicholas ├── @actual-app/api@6.2.1 ├── bundle@2.1.0 ├── express@4.18.2 ├── webpack@5.88.2 └── yarn@1.22.19 On Sat, 26 Aug 2023 at 19:39, Matiss Janis Aboltins < ***@***.***> wrote: > The latest version is 6.2.1 🤔 > > ***@***.***/api?activeTab=versions > > — > Reply to this email directly, view it on GitHub > <https://github.com/actualbudget/actual/issues/1585#issuecomment-1694243570>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AE2HTLFY2A7LBVNAY6Z75DDXXG73XANCNFSM6AAAAAA36FFT7M> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
Author
Owner

@MatissJanis commented on GitHub (Aug 26, 2023):

The version numbers are masked @niko123456000

<!-- gh-comment-id:1694247296 --> @MatissJanis commented on GitHub (Aug 26, 2023): The version numbers are masked @niko123456000
Author
Owner

@niko123456000 commented on GitHub (Aug 26, 2023):

The version numbers are masked @niko123456000

sorry! I replied by email, didn't know that was a thing ;)

$ npm list
nicholas@ /home/nicholas
├── @actual-app/api@6.2.1
├── bundle@2.1.0
├── express@4.18.2
├── webpack@5.88.2
└── yarn@1.22.19

<!-- gh-comment-id:1694247597 --> @niko123456000 commented on GitHub (Aug 26, 2023): > The version numbers are masked @niko123456000 sorry! I replied by email, didn't know that was a thing ;) $ npm list nicholas@ /home/nicholas ├── @actual-app/api@6.2.1 ├── bundle@2.1.0 ├── express@4.18.2 ├── webpack@5.88.2 └── yarn@1.22.19
Author
Owner

@MatissJanis commented on GitHub (Aug 26, 2023):

I have the exact same set-up as you and things are working perfectly fine for me. So I'm not really sure what the issue might be..

Maybe try running my code snippet posted above against your server?

If that doesn't work - an export of your budget (with redacted information) would be helpful.

<!-- gh-comment-id:1694353002 --> @MatissJanis commented on GitHub (Aug 26, 2023): I have the exact same set-up as you and things are working perfectly fine for me. So I'm not really sure what the issue might be.. Maybe try running my code snippet posted above against your server? If that doesn't work - an export of your budget (with redacted information) would be helpful.
Author
Owner

@niko123456000 commented on GitHub (Aug 27, 2023):

I have created a new budget file and I still get the same issues.

If I keep init and downloadBudget I get a 'segementation fault' on node v20 or 'stack smashing detected' on node v18.

in a last ditch attempt I installed node directly into Windows... (not WSL or Pop_OS): it worked.

On Pop_OS I got an error that sqlite was built using a different package version but couldn't really figure out where that was coming from.. it wasn't in my package-lock.json file.

<!-- gh-comment-id:1694576139 --> @niko123456000 commented on GitHub (Aug 27, 2023): I have created a new budget file and I still get the same issues. If I keep init and downloadBudget I get a 'segementation fault' on node v20 or 'stack smashing detected' on node v18. in a last ditch attempt I installed node directly into Windows... (not WSL or Pop_OS): it worked. On Pop_OS I got an error that sqlite was built using a different package version but couldn't really figure out where that was coming from.. it wasn't in my package-lock.json file.
Author
Owner

@porjo commented on GitHub (Aug 28, 2023):

I'm seeing the same error with api.createAccount(account);

/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:31964
                        let latestTimestamp = (0, _actual_app_crdt__WEBPACK_IMPORTED_MODULE_0__.getClock)().timestamp.toString();
                                                                                                           ^

TypeError: Cannot read properties of undefined (reading 'timestamp')
    at undoDisabled (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:31964:108)
    at _runMutator (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:41044:24)
    at run (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:44421:45)
    at sequenceState.queue.push.resolve.resolve (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:44433:36)
    at new Promise (<anonymous>)
    at /root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:44432:32
    at /root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:31963:83
    at runHandler (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:41028:31)
    at Object.send (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:40685:92)
    at send (/root/actual/node_modules/@actual-app/api/dist/methods.js:34:21)

Fedora 38 (Docker container)
Node v18.17.1

 npm list
actual@ /root/actual
└── @actual-app/api@6.2.1
app.js
let api = require('@actual-app/api');
let data = require('/root/actual/my-data.json');


(async () => {
	await api.init({
		// Budget data will be cached locally here, in subdirectories for each file.
		dataDir: '/tmp',
		// This is the URL of your running server
		serverURL: 'https://example.com',
		// This is the password you use to log into the server
		password: 'xxxxxxxxxxx'
	});

//	async function run() {
		for (let account of data.accounts) {
			console.log("account", account);
			let acctId = await api.createAccount(account);
			console.log("account id", acctId);
			/*
			await api.addTransactions(
				acctId,
				data.transactions
				.filter(t => t.acctId === acctId)
				.map(convertTransaction),
			);
			*/
		}
//	}

//	await api.runImport('My-Budget', run);

	await api.shutdown();
})();
<!-- gh-comment-id:1696524938 --> @porjo commented on GitHub (Aug 28, 2023): I'm seeing the same error with `api.createAccount(account);` ``` /root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:31964 let latestTimestamp = (0, _actual_app_crdt__WEBPACK_IMPORTED_MODULE_0__.getClock)().timestamp.toString(); ^ TypeError: Cannot read properties of undefined (reading 'timestamp') at undoDisabled (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:31964:108) at _runMutator (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:41044:24) at run (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:44421:45) at sequenceState.queue.push.resolve.resolve (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:44433:36) at new Promise (<anonymous>) at /root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:44432:32 at /root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:31963:83 at runHandler (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:41028:31) at Object.send (/root/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:40685:92) at send (/root/actual/node_modules/@actual-app/api/dist/methods.js:34:21) ``` Fedora 38 (Docker container) Node v18.17.1 ``` npm list actual@ /root/actual └── @actual-app/api@6.2.1 ``` <details> <summary>app.js</summary> ```js let api = require('@actual-app/api'); let data = require('/root/actual/my-data.json'); (async () => { await api.init({ // Budget data will be cached locally here, in subdirectories for each file. dataDir: '/tmp', // This is the URL of your running server serverURL: 'https://example.com', // This is the password you use to log into the server password: 'xxxxxxxxxxx' }); // async function run() { for (let account of data.accounts) { console.log("account", account); let acctId = await api.createAccount(account); console.log("account id", acctId); /* await api.addTransactions( acctId, data.transactions .filter(t => t.acctId === acctId) .map(convertTransaction), ); */ } // } // await api.runImport('My-Budget', run); await api.shutdown(); })(); ``` </details>
Author
Owner

@8bitgentleman commented on GitHub (Nov 26, 2023):

I had the same issues all described here and the only thing that fixed it was downgrading to node v18.18.2 using nvm

<!-- gh-comment-id:1826873422 --> @8bitgentleman commented on GitHub (Nov 26, 2023): I had the same issues all described here and the only thing that fixed it was downgrading to node v18.18.2 using nvm
Author
Owner

@efess commented on GitHub (Dec 3, 2023):

I'm having this same issue while initializing the API in actual-simplefin-sync - the db sync _fullSync function calls getClock - but this call is too early because setClock has not been called yet.

I wonder if previous "cannot reproduce" attempts in this thread started with an empty dataDir folder?

I'm running node version v18.14.2 on windows/bash

<!-- gh-comment-id:1837495652 --> @efess commented on GitHub (Dec 3, 2023): I'm having this same issue while initializing the API in `actual-simplefin-sync` - the db sync `_fullSync` function calls `getClock` - but this call is too early because `setClock` has not been called yet. I wonder if previous "cannot reproduce" attempts in this thread started with an empty `dataDir` folder? I'm running node version `v18.14.2` on windows/bash
Author
Owner

@efess commented on GitHub (Dec 3, 2023):

This may not be an issue anymore - actual-simplefin-sync was using version 6.2.1 of the API. Updating this to the latest (6.3.0) and this is not reproducible

<!-- gh-comment-id:1837499341 --> @efess commented on GitHub (Dec 3, 2023): This may not be an issue anymore - `actual-simplefin-sync` was using version 6.2.1 of the API. Updating this to the latest (6.3.0) and this is not reproducible
Author
Owner

@ErnstHaagsman commented on GitHub (Jul 2, 2024):

I'm reproducing this issue with the following minimal code:

const api = require("@actual-app/api");
(async () => {
    await api.init({
        // This is the URL of your running server
        serverURL: 'http://localhost:5006',
        // This is the password you use to log into the server
        password: 'hunter2',
    });

    await api.shutdown();
})();

Error:

TypeError: Cannot read properties of undefined (reading 'timestamp')
    at _fullSync (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:42591:98)
    at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:42503:38
    at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:43449:38
    at handlers.sync (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:38679:73)
    at runHandler (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:39555:33)
    at Object.send (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:39237:94)
    at Object.shutdown (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\index.js:59:25)
    at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\minimal.js:10:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Exception] TypeError: Cannot read properties of undefined (reading 'timestamp')
    at _fullSync (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:42591:98)
    at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:42503:38
    at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:43449:38
    at handlers.sync (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle
                                                                                                           e.api.js:38679:73)
    at runHandler (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.ap
                                                                                                           pi.js:39555:33)
    at Object.send (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.a
                                                                                                           api.js:39237:94)
    at Object.shutdown (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\index.js
                                                                                                           s:59:25)
    at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\minimal.js:10:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Process finished with exit code 0

Both with Node 18.20.3 and Node 20.15.0. Actual API version 6.8.2

<!-- gh-comment-id:2204578893 --> @ErnstHaagsman commented on GitHub (Jul 2, 2024): I'm reproducing this issue with the following minimal code: ``` const api = require("@actual-app/api"); (async () => { await api.init({ // This is the URL of your running server serverURL: 'http://localhost:5006', // This is the password you use to log into the server password: 'hunter2', }); await api.shutdown(); })(); ``` Error: ``` TypeError: Cannot read properties of undefined (reading 'timestamp') at _fullSync (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:42591:98) at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:42503:38 at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:43449:38 at handlers.sync (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:38679:73) at runHandler (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:39555:33) at Object.send (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:39237:94) at Object.shutdown (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\index.js:59:25) at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\minimal.js:10:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) [Exception] TypeError: Cannot read properties of undefined (reading 'timestamp') at _fullSync (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:42591:98) at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:42503:38 at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.api.js:43449:38 at handlers.sync (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle e.api.js:38679:73) at runHandler (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.ap pi.js:39555:33) at Object.send (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\app\bundle.a api.js:39237:94) at Object.shutdown (C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\node_modules\@actual-app\api\dist\index.js s:59:25) at C:\Users\Ernst.Haagsman\WebstormProjects\actualimport\minimal.js:10:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Process finished with exit code 0 ``` Both with Node 18.20.3 and Node 20.15.0. Actual API version 6.8.2
Author
Owner

@ErnstHaagsman commented on GitHub (Jul 2, 2024):

Turns out you need to always run api.downloadBudget in between. That fixed the problem for me.

<!-- gh-comment-id:2204612666 --> @ErnstHaagsman commented on GitHub (Jul 2, 2024): Turns out you need to always run `api.downloadBudget` in between. That fixed the problem for me.
Author
Owner

@tom5491 commented on GitHub (Aug 18, 2024):

Not sure if this helps anyone but I was getting the Segmentation fault (core dumped) error and entering npm rebuild fixed it for me

<!-- gh-comment-id:2295243858 --> @tom5491 commented on GitHub (Aug 18, 2024): Not sure if this helps anyone but I was getting the Segmentation fault (core dumped) error and entering `npm rebuild` fixed it for me
Author
Owner

@eddiegroves commented on GitHub (Aug 25, 2024):

Confirmed ErnstHaagsman comment above that the work around is to use downloadBudget after init before using other APIs methods.

<!-- gh-comment-id:2308755511 --> @eddiegroves commented on GitHub (Aug 25, 2024): Confirmed ErnstHaagsman comment above that the work around is to use `downloadBudget` after `init` before using other APIs methods.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#7532