OpenFn / OpenFn/kit

Worker: do something better when the JWT expires

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

Nobody has claimed this yet.

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

Description

We've had some problems lately with the JWT on the run channel expiring , causing messages to fail.

It looks a bit like this:

image

The worker should do better in these cases, throwing a clear error and existing the channel and maybe the socket.

The question is WHERE we report. We can't tell lightning because, well, the JWT expired. Any attempts to send a message back will be rejected.

This comes into monitoring - we don't have a monitoring solution yet, other than lightning and GCP.

Perhaps a good approach is to shut the whole server down (probably gracefully) with a clear error like "expired JWT detected" and stop requesting traffic. That depends a bit whether it's one run that's expired or whether all JWTs are wrong.

We probably don't unit test for any of this very well at the moment. I think unit testing and clear logs to GCP are the first step. That also makes it easier for us to trace where to add more monitoring later.

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 locating the worker's run-channel JWT handling and any existing unit tests or GCP logging for expiry failures. Define the behavior for one expired run versus invalid JWTs generally, then add tests and clear logging that verify the chosen graceful channel, socket, or server shutdown behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication, backend, observability
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.