OpenFn / OpenFn/kit

Standardise socket errors between lightning an the worker

Open
#951 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DevX
Dominant language
TypeScript
Stars
21
Forks
23
Avg merge
1d 22h
Merged PRs (30d)
17

Description

We need to ensure that when Lightning returns an error to the worker through the socket (ie, failing to get a credential, missing properties on step:complete), the structure of that error is consistent and parsable by the worker.

I think that Lightning is fairly consistent in how it returns errors, but the worker certainly is not. We need good (and accurate and up to date) typings, good errors returned by the mock lightning, and updated tests

One part of this I want to think about is that Lightning returns a generic error object with errors per thing, by id. Like:

errors: {
   'asdfe-afafaf-afaa': [ error1, error2 ]
}

But often the context should make it clear what is in error. Like on fetch credential, we know the related run and we know the requested credential id. So logging the whole error object probably isn't useful for users - we need to parse the error structure and pull out just the relevant information.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how Lightning sends socket errors to the worker, including credential failures and missing step:complete properties, then inspect the existing worker typings, mock Lightning responses, and related tests. Done means the error structure is consistent and parsable, typings are accurate, mock errors match it, and tests cover the updated behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.