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

Verify `agentOptions` and http auth configuration for ssl certs is working when sending POSTs to Progres/DTP #49

Closed aleksa-krolls closed 2 years ago

aleksa-krolls commented 2 years ago

Request

Job is currently failing with the below error when we send a POST request to DTP. See example run.

statusCode: 403,
statusMessage: 'Certificate failed thumbprint match',

Please test with the sample state below to try to successfully run the job and validate the http adaptor and agentOptions are working as expected... . OR see L215 in the run log for an exact payload to test posting to DTP.

state.json

Primero - Job f2-1 (change cursor & run to generate state for Job 2) configuration: See LP Primero Gambella - Get Referrals (PROD) manualCursor: '2022-05-05T11:40:04.033Z'

DTP - Job f2-2 (to troubleshoot) configuration: See LP DTP - ReceiveIncomingReferral (PROD) data: output from Job 1

adaptor

language-http v3.1.11

trigger

https://github.com/OpenFn/primero-progres/blob/master/jobs/PROD/f2-1.getCasesFromPrimero.js Run the Primero job f2-1 with the manual cursor provided above to generate state for the DTP job f2-2.

expression.js

https://github.com/OpenFn/primero-progres/blob/master/jobs/PROD/f2-2.sendReferralToDTP.js

output.json

See if you can successfully authenticate with DTP.

taylordowns2000 commented 2 years ago

@aleksa-krolls , this looks good. we're using the new http agent as directed:

const options = {
  hostname: 'encrypted.google.com',
  port: 443,
  path: '/',
  method: 'GET',
  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
options.agent = new https.Agent(options);

I'd recommend that, as we're testing anyway, we bump to http 4.0.0 for the newest patches but otherwise we need to wait for them to confirm that this all worked as expected in staging.

aleksa-krolls commented 2 years ago

thanks @taylordowns2000. I've bumped the jobs up to http 4.0.0. Closing for now as tests are passing, and will wait for any feedback from UNHCR.