OpenFn / OpenFn/adaptors

`primero` A bug when using `getCases` on a new `@openfn/cli`

Open
#189 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
24
Forks
41
Avg merge
3d 13h
Merged PRs (30d)
12

Description

Description

A bug in primero adaptors when using

Logs
aleksakrolls@MacBook-Pro-5 tmp % openfn ./getPrimeroCases.js -ia primero@2.7.0 -s ./state.json
[CLI] ✔ Installing packages...
[CLI] ✔ Installation complete in 2ms
[CLI] ✔ Loaded state from ./state.json
[CLI] ✔ Compiled job from ./getPrimeroCases.js
Primero says: '200 OK'
/private/tmp/openfn/repo/node_modules/@openfn/language-primero_2.7.0/lib/Adaptor.js:317
          console.log(`${cases.length} cases retrieved from request: ${JSON.stringify(response.request, null, 2)}`);
                               ^
TypeError: Cannot read properties of undefined (reading 'length')
    at Request._callback (/private/tmp/openfn/repo/node_modules/@openfn/language-primero_2.7.0/lib/Adaptor.js:317:32)
    at self.callback (/private/tmp/openfn/repo/node_modules/@openfn/language-primero_2.7.0/node_modules/request/request.js:185:22)
    at Request.emit (node:events:513:28)
    at Request.<anonymous> (/private/tmp/openfn/repo/node_modules/@openfn/language-primero_2.7.0/node_modules/request/request.js:1154:10)
    at Request.emit (node:events:513:28)
    at IncomingMessage.<anonymous> (/private/tmp/openfn/repo/node_modules/@openfn/language-primero_2.7.0/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (node:events:627:28)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.12.1

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 with the Primero adaptor's lib/Adaptor.js around line 317 and reproduce the getCases call using the openfn CLI command and Primero 2.7.0 shown in the logs. Trace why the successful 200 response leaves cases undefined; done means the command handles that response without the TypeError and reports retrieved cases correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.