OpenFn / OpenFn/kit

Linker: be better about loading adaptors from the filesystem

Open
#252 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

If you do openfn -a ../my-adaptor/, the linker will fail to load your adaptor module.

Technically we support passing a path as an adaptor. But we're not very good with paths, apparently.

Here's the problematic code in src/modules/linker.ts:

  // If the specifier is a path, just import it
  if (specifier.startsWith('/') && specifier.endsWith('.js')) {
    const importPath = `${prefix}${specifier}`;
    log.debug(`[linker] Loading module from path: ${importPath}`);
    return import(importPath);
  }

I mean, say no more.

We do have a well-tested function somewhere for detecting an absolute or relative path, so we should be able to handle this.

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 src/modules/linker.ts and inspect the existing well-tested function for detecting absolute or relative paths. Exercise the openfn -a ../my-adaptor/ entry point and confirm that adaptor modules supplied by relative or absolute filesystem paths load successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.