Salesforce REST API fails only on webhook execution, but not manual execution in testing

Product/components used and version/fix level are you on:

webMethods cloud version

Detailed explanation of the problem:

I have data coming in from a json webhook, which is being used to query salesforce records in my salesforce instance. When running the execution manually during testing, my workflow executes with no issues (including successfully accessing Salesforce with my credentials, querying records, and creating new records in a later step within the workflow). However, when I activate my workflow; I get the following error message:

Error messages / full error message screenshot / log fileL

“message”:“Error while parsing response data”
type Status Report
Message Unauthorized
Description http.401

Is your question related to the free trial, or to a production (customer) instance?

free trial

Have you installed all the latest fixes for the products and systems you are using?

yes

Hello @Daniel_Adayev ,

Can you please explain by activating workflow means are you trying to invoke workflow post that which resulted in error or while saving workflow are you getting errors ?

Kindly share the screenshot of the flow and error ?

Regards,
Bharath

Hello Bharath,

Apologies for not clarifying. Activate is not the appropriate term to use here.

What I meant is that when I invoke the Salesforce REST CRM Flow step through manual execution during testing, I am able to successfully authenticate and query/create records using the workflow.

However, when I invoke the workflow and the associated workflow steps through a webhook submission to my endpoint url, which is what my trigger is firing off of, I get a 401 “error while parsing response data”. I’ve attached screenshots of my flow and the associated error message.

The flow is failing at the queryContacts flowstep with the following error. Not sure if this is relevant, but the json comes in as an array of records, so these steps are inside of a loop flowstep.

{
  "message": "Error while parsing response data",
  "data": "<html><head><title> - null</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 – Unauthorized</h1><HR size=\"1\" noshade=\"noshade\"><p><b>type</b> Status Report</p><p><b>Message</b> <u>Unauthorized</u></p><p><b>Description</b> <u>http.401</u></p><HR size=\"1\" noshade=\"noshade\"><h3></h3></body></html>"
}

Hello @Daniel_Adayev ,

Perfect, thanks for sharing the details, will check this out at my end and get back to you soon.

Regards,
Bharath

1 Like

Hello @Daniel_Adayev ,

i have simulated your workflow and able to perform query operations via webhook call as well as manual executions. (see below)

Also attaching the workflow export for your reference , let me know is this helps ?
export-flb72c455bbfa3f2a06e6aae-1681796953086.zip (114.0 KB)

Regards,
Bharath

Hello Bharath,

Thank you for testing. It seems like the issue might be in how I set up the connector. When you set up the Salesforce API, did you do it through an authorization code flow or a JWT flow? Also did you need to do anything on the Salesforce side like set up a new remote site setting?

Best Regards,
Daniel

1 Like

Hello @Daniel_Adayev ,

I went though basic auth for Salesforce, which one you are trying out with ?

Also i didn’t do any extra setting on SF side.

Regards,
Bharath

Hello,

Turns out this was an issue with my environment, not the connector. Support was able to get it resolved.

Thank you!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.