OpenFn / primero-progres

Interoperability solution for UNICEF <> UNHCR interagency referrals between Primero and Progres v4 systems.
https://openfn.github.io/primero-progres/
0 stars 2 forks source link

Flow 1: Job2 fails when trying to log IDs from Job1 response #72

Closed aleksa-krolls closed 1 year ago

aleksa-krolls commented 1 year ago

Describe the bug

Job2 is failing with error TypeError [Error]: Cannot read properties of undefined (reading 'case_id') because the variables (which reference Job1’s response) are showing undefined in the console.logs. I wonder if Job1 is giving us a different response that we originally anticipated.

To Reproduce

  1. Run Job1 against this sample payload to create a case in Primero staging:
  2. Use the response^ from Job1 as the initial state for job 2.

expression.js

Job1 using language-primero@2.3.4: https://github.com/OpenFn/primero-progres/blob/master/jobs/PROD/f1-1.sendReferralsToPrimero.js

Job2 using language-http@4.0.0: https://github.com/OpenFn/primero-progres/blob/master/jobs/PROD/f1-4.sendSuccessToDTP.js

state.json

Please make changes on a branch off of main, and submit PR to staging when ready to test.

Job1:

{
  "configuration": ["SEE LAST PASS: 'Primero Gambella Demo [openfn testing]'"],
  "data": "https://github.com/OpenFn/primero-progres/blob/master/sampleData/flow1__PrimeroOutgoingReferral.json",
  "cursor": "NA"
}

Job2 → Please comment out all operations so to not actually try sending this job to DTP… just try to resolve the console.log() issue.

{
  "configuration": "NA bc we don’t actually want to send DTP a notification in this test",
  "data": "Job1 final state",
  "cursor": "NA"
}

Expected behavior

After we create the case in job1, we should correctly log its case_id in job2.

Toggl

UNICEF Primero-Progres Support [2022-24]

aleksa-krolls commented 1 year ago

fyi @daissatou2 seeing this fail on platform as well - can use your help with testing in staging project once Mtuchi is done

mtuchi commented 1 year ago

@aleksa-krolls some concern around this comment Please make changes on a branch off of main, and submit PR to staging when ready to test.

Main and Staging have different commit The last commit for jobs/PROD/f1-1.sendReferralsToPrimero.js on main is 1 year ago last commit - f8a4f91, while on staging is 6 month ago last commit - 597f7de

if i open the PR against staging once it's merged to main it will have other changes that staging branch currently have

mtuchi commented 1 year ago

I am an able to to run the workflow locally successful using the credentials provided in the issue Primero Gambella Demo (openfn testing). But i have spotted the issue and raise a PR against staging see #73