Skip to main content

I have a flow that has the Salesforce create connector, the Munit test that references the flow Runs fine locally. But when I try to deploy them to the CloudHub using the Azure Devops CI/CD pipeline throws error like

 

WARN 2022-04-07 23:41:54,103 [[MuleRuntime].uber.04: [mule-salesforce-sys].salesforce-Opportunity-create-flow/processors/3.ps.BLOCKING @3c7baec] org.mule.extension.salesforce.internal.connection.provider.BasicConnectionProvider: Couldn't obtain access token because an exception has occurred. Runtime to handle the ConnectionException. Root exception was: Invalid status code: 400, response body: {"error":"invalid_client","error_description":"invalid client credentials"}

 

.

 

org.mule.runtime.extension.api.exception.ModuleException: Invalid status code: 400, response body: {"error":"invalid_client","error_description":"invalid client credentials"}

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

Invalid status code: 400, response body: {"error":"invalid_client","error_description":"invalid client credentials"}

 

But before I created the Munit tests I deployed the flow to the CloudHub and there was no issues or error. I can still access the endpoint. After adding the Munit tests and deploying it throws error. All the credentials are stored in the Pipeline Variables..

 

And the Munit test

 

<munit:test name="salesforce-sys-implementation-test-suite-salesforce-Opportunity-create-flowTest" doc:id="c9779a45-00fe-4e08-b3e7-2580e68352ef" description="Test">

<munit:behavior>

<munit-tools:mock-when doc:name="Mock when" doc:id="a2ff9717-a4ee-4bea-9caf-9e3d5fe591b7" processor="flow">

<munit-tools:with-attributes >

<munit-tools:with-attribute whereValue="post:\opportunity:application\json:salesforce-system-api-config" attributeName="name" />

</munit-tools:with-attributes>

<munit-tools:then-return >

<munit-tools:payload value="#{}" mediaType="application/json" encoding="UTF-8" />

</munit-tools:then-return>

</munit-tools:mock-when>

</munit:behavior>

<munit:execution >

<munit:set-event doc:name="Set Event" doc:id="4c21ba83-a2d8-47f7-a327-33a772f980c6" >

<munit:payload value='{

&#10; "name": "X",

&#10; "SowGenerationStage": "SOW Requested",

&#10; "dateOfFirstContact": "2022-03-28",

&#10; "closeDate": "2022-03-28",

&#10; "SowRequestDate": "2022-03-28T12:48:16Z",

&#10; "accountId": "001T7IAM",

&#10; "contact": "003U0",

&#10; "leadSource": "Project Management",

&#10; "recordTypeId": "012U0000000QBXWIA4",

&#10; "serviceType": "SPR",

&#10; "priceBook2ID": "01s",

&#10; "stageName": "Discover"

&#10;}' mediaType="application/json" />

</munit:set-event>

<flow-ref doc:name="Flow-ref to salesforce-Opportunity-create-flow" doc:id="3c3d043f-f1ad-4b8d-9290-d407400d14a6" name="salesforce-Opportunity-create-flow"/>

</munit:execution>

<munit:validation >

<munit-tools:assert-that doc:name="Assert that Not Null Response" doc:id="da165ba2-619f-462e-8278-e66ee771cb08" is="#MunitTools::notNullValue()" expression="#payload.Id"/>

</munit:validation>

</munit:test>

6 réponses
  1. 8 avr. 2022, 21:47

    Hello,

     

    Please select the correct processor in MUnit Mock component. I am sure It will work. I checked your attachment it was wrong.

     

    Sample below: Working

     

    Hello, Please select the correct processor in MUnit Mock component. I am sure It will work. I checked your attachment it was wrong.

0/9000