Skip to content

Getting started code is broken in multiple ways #10

@mryall-mawson

Description

@mryall-mawson

I'm trying to get started with Flowcraft, but the demo code not working is a big impediment. There are multiple issues.

I dropped the sample code from Getting Started into a completely new TS project, and there are immediately compilation errors:

  1. The primary function run() is missing a closing brace, on line 45. This was noticed and a PR raised (Fix Import Path Normalization + Getting Started Examples #3) four months ago, but has not been reviewed or fixed.
  2. The code is missing an import for NodeContext, which is used on lines 4 & 10.
  3. On line 24, the constructor new FlowRuntime() doesn't match either of the available constructors. It needs to either provide the default container, by importing getDefaultContainer(), or pass an empty options object. I decided to use the empty object as it seemed simpler.

With these fixed, the code now runs, but it doesn't work properly. There are multiple issues here too.

  1. The workflow execution fails with Implementation for 'fn_7d287648' not found. This is because the workflow runtime requires a function registry, and we are not providing one.

    • I found two ways to do this:
      1. via options.registry in the FlowRuntime constructor, which requires a Record (not a Map), so we need to pass in Object.entries(flow.getFunctionRegistry())
      2. via options.functionRegistry in runtime.run()
    • I chose b) because I would rather have the flow-based logic passed when running a workflow, rather than when constructing the runtime.
  2. Now, the functions are running, but the double function is not getting executed. I get the following output from the demo code, showing that the pause() function (and the overall workflow) is still in an awaiting state.

Workflow Result: {
  context: {
    value: 42,
    "_outputs.start": 42,
    "_inputs.pause": 42,
    _awaitingNodeIds: [ "pause" ],
    _awaitingDetails: {
      pause: { reason: "timer", wakeUpAt: "2026-03-25T05:44:55.194Z" }
    },
    "_outputs.pause": undefined,
    "_inputs.double": undefined,
    _executionId: "d68cefef-21ac-41b7-b14b-d87b3f7592a6"
  },
  serializedContext: '{"value":42,"_outputs.start":42,"_inputs.pause":42,"_awaitingNodeIds":["pause"],"_awaitingDetails":{"pause":{"reason":"timer","wakeUpAt":"2026-03-25T05:44:55.194Z"}},"_executionId":"d68cefef-21ac-41b7-b14b-d87b3f7592a6"}',
  status: "awaiting",
  errors: undefined
}

I have tried to resume the workflow by checking result.status and calling runtime.resume(), but this fails with FlowcraftError: Cannot resume: The provided context is not in an awaiting state.

Any suggestions on how to get this code working? Is this library still being developed and actively used? Why is the demo code not tested?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions