OpenFn / OpenFn/lightning

Provisioner API: Invalid yaml is returned if a job starts with an indent

Open
#4,100 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Not sure exactly what the problem here is - but basically this job:


  function isNonEmptyString(v) {
    return typeof v === 'string' && v.trim().length > 0;
  }

Creates invalid yaml in the provisioner, which makes openfn pull break

To reproduce:

  • Make sure you have CLI at least 1.19.0 installed (run openfn version to check)
  • Create a folder called indent-test on your machine
  • Inside, create a .env like this:
OPENFN_API_KEY=<your key>
OPENFN_ENDPOINT="https://app.staging.openfn.org/"
  • Run openfn pull 3b1193b8-fb92-4c3d-9053-71f38bfc2e1f --log debug
  • You'll get an error like SPEC_ERROR: All mapping items must start at the same column at line...
  • To see the raw yaml, follow the stack trace to open up index.js at extractJobsToDisk and add this code at the top of the function
const fs = await import('fs')
fs.writeFileSync('project.yaml', specBody)

That will output project.yaml for you to inspect. Paste the output into a yaml validator and it'll throw

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 index.js at extractJobsToDisk and reproduce with openfn pull 3b1193b8-fb92-4c3d-9053-71f38bfc2e1f --log debug using the provided indented function. Inspect the generated project.yaml with a YAML validator and trace how the job text is assembled. Done means the generated YAML remains valid and openfn pull completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, yaml
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.