CLI Deploy: bad error message if project yaml has a workflow not in state json
josephjclark opened this issue · 0 comments
josephjclark commented
I don't really know how this state occurs, but if state.json and project.yaml lose sync, and a workflow exists in the project but not the state, you get an unhelpful error message:
Workflow found in project state but not spec. Spec: undefined State: [object Object]
[CLI] ✘ Command failed!
[CLI] ✘ Error: Cannot continue: workflow from state not found in spec.
at file:///d/repo/openfn/kit/packages/deploy/dist/index.js:344:17
at Array.map (<anonymous>)
at mergeSpecIntoState (file:///d/repo/openfn/kit/packages/deploy/dist/index.js:311:50)
at deploy (file:///d/repo/openfn/kit/packages/deploy/dist/index.js:636:21)
at async deployHandler (file:///d/repo/openfn/kit/packages/cli/dist/process/runner.js:1177:18)
I would also love stack traces to be removed from these errors, unless perhaps logging in debug mode. It's not helpful and looks like the CLI is broken
Repro Steps
- Pull a project from lightning (I like to use demo but you can use local or app or whatever you want)
- rename one of the workflows in your
project.yaml
(do not remove it, just rename it) - Run pull on the same project
Note that straight deleting a workflow from state.json
seems to cause a different problem which also needs investigating. All the step/trigger ids seem to change, like it's confusing workflows (like it's applying the ids from the removed workflow to the remaining workflow).