OpenFn / OpenFn/kit

CLI: repo gets trashed (after update)

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

Nobody has claimed this yet.

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

Description

I've noticed a few problems now where the CLI repo gets trashed. It's just happened to Taylor after updating versions (and come to think of it I think the last time we saw this was after an update as well).

Cleaning the repo fixes it.

The symptom seems to be random errors coming out of adaptor code on stuff that was working recently. Here's Taylor's last error:

[R/T] ℹ Resolved adaptor @openfn/language-http to version 5.0.1
node:internal/modules/cjs/loader:400
      const err = new Error(
                  ^

Error: Cannot find module '/private/tmp/openfn/repo/node_modules/form-data/lib/form_data'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:400:19)
    at Module._findPath (node:internal/modules/cjs/loader:613:18)
    at Module._resolveFilename (node:internal/modules/cjs/loader:981:27)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/private/tmp/openfn/repo/node_modules/@openfn/language-http_5.0.1/dist/index.cjs:94:32)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/private/tmp/openfn/repo/node_modules/form-data/package.json',
  requestPath: 'form-data'
}

This needs tracking and investigating. Some possible steps:

  • Add repo clean to the troubleshooting guide
  • Detect this sort of error and recommend a repo clean
  • Is this build or version related changes? Like if we autoinstall with cli (or npm) version a, then update to version b, is that when we get a problem?
  • Add better validation to the repo api which can detect this problem (is it that some dependencies get removed somehow?)
  • Add a command like openfn repo refesh which will just reinstall the repo. Maybe openfn update which will do this and update the CLI for you.

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 examining the CLI's repo update and autoinstall flow, along with the repo API, then reproduce the failure by updating between CLI versions and checking dependency contents. Compare the behavior before and after cleaning the repo. Done means identifying the cause and choosing a concrete remediation, such as troubleshooting guidance, validation, or a refresh command.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, tooling
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.