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

Connection issues when Actual is started after API client #3

@heilerich

Description

@heilerich

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.");
   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions