OpenFn / OpenFn/lightning

Selecting a job node with a slow internet causes a `:timeout` error

Open
#1,739 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug performance
Dominant language
Elixir
Stars
296
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
50

Description

Describe the bug A clear and concise description of what the bug is.

When you select a node in a workflow with a slow internet (or no internet at all), the app crashes with the following HTTPoison timeout error.

[error] Task #PID<0.7362.0> started from Lightning.AdaptorRegistry terminating
** (HTTPoison.Error) :timeout
    (lightning 2.0.0) lib/lightning/adaptor_registry.ex:46: Lightning.AdaptorRegistry.Npm.request!/5
    (lightning 2.0.0) lib/lightning/adaptor_registry.ex:84: Lightning.AdaptorRegistry.Npm.package_detail/1
    (lightning 2.0.0) lib/lightning/adaptor_registry.ex:253: Lightning.AdaptorRegistry.fetch_npm_details/1
    (elixir 1.15.4) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
    (elixir 1.15.4) lib/task/supervised.ex:36: Task.Supervised.reply/4
Function: &:erlang.apply/2
    Args: [#Function<3.61948593/1 in Lightning.AdaptorRegistry.fetch_npm_details>, ["@openfn/language-azure-storage"]]

Version number The version of Lightning you have seen the bug on.

This is happening on main. My git head is at 93a51614a737620020e1c4f82997b64bc855de6d at the time I got the error.

I have reproduced this locally on main:

  • Yes
  • No

To Reproduce Steps to reproduce the behavior:

  1. Launch Lightning with a slow internet / or no internet
  2. Go to the workflow canvas and select a job node
  3. See the app crashing and the job panel not opening
  4. See error in your iex server

Expected behavior A clear and concise description of what you expected to
happen.

Instead of the app crashing we should handle the timeout error in the AdaptorRegistry and display an informative error message

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 in lib/lightning/adaptor_registry.ex, especially Npm.request!/5, package_detail/1, and fetch_npm_details/1, using the reported timeout during node selection as the reproduction case. Confirm that a slow or unavailable network no longer crashes the app, that the job panel opens, and that an informative error is displayed.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.