Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Connection issues when Actual is started after API client #3

Open
heilerich opened this issue Mar 13, 2021 · 0 comments
Open

Connection issues when Actual is started after API client #3

heilerich opened this issue Mar 13, 2021 · 0 comments

Comments

@heilerich
Copy link

I am experiencing connection issues when the API client is invoked before Actual has started.

The problem occurs when doing the following

  1. Try to connect to the API before Actual has started
  2. Start Actual
  3. Retry the connection
  4. The connection is never established

I have not investigated further, but I think this line might be a problem

if (initialized) {

Maybe an unsuccessful connection attempt returns something that evaluates as truthy?

I am not sure if this is the best solution, but applying this patch fixes the problem

--- a/node_modules/@actual-app/api/connection.js
+++ b/node_modules/@actual-app/api/connection.js
@@ -41,6 +41,7 @@ async function init(socketName) {
     // TODO: This could spawn Actual automatically. The ideal solution
     // would be to bundle the entire backend and embed it directly
     // into the distributed library.
+    initialized = false;
     throw new Error("Couldn't connect to Actual. Please run the app first.");
   }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant