0

I have been following the instructions provided in the official salesforce developer docs here regarding importing mulesoft apis using sfdc external services for use in a flow. I have followed the instructions to the letter, exactly as they are described and ultimately when attempting to hit the api recieve a "301 - Moved Permanently" response.

For some info, not sure what is relevant and what isn't:

  1. The api is running on a Cloudhub worker in a non-prod environment, and we have a DLB and VPC configured

  2. The external service, named credential, and flow are all configured in a dev sandbox environment.

  3. One thing I attempted was to change the URL in the named credential to the actual endpoint for my mule api (https://nonprod-api.myorg.com/example-api-name-dev/api/v1), instead of https://anypoint.mulesoft.com, just to see if anything changes. Interestingly, the error response changes to "PKIX path building error; no valid certificate found for build path". I switched back to https://anypoint.mulesoft.com, but the fact the error changes may suggest my 301 problem lies with the named credential.

Ultimately I am a little confused why following a walkthrough exactly step by step as it is described leads to this error; this almost suggests to me there is some kind of custom browser configuration on my side that I am not aware of causing some kind of redirect. I have attempted to inspect network traffic with console and wireshark to get some indication of whats happening when I debug the flow and get 301, but haven't been able to see anything unusual.

Edit: I have also ensured the api is working properly by testing the endpoint with postman and receiving a successful response. Everything is working properly on the Mulesoft side.

4
  • It could be an issue between Mulesoft and your service. The first step would be to debug this in Mulesoft. If you've done so, please edit your question and provide more detail.
    – identigral
    Apr 25 at 17:08
  • 1
    It doesn't seem the request ever reaches Mulesoft, or to put another way the request never reaches the api endpoint URL. That's why I wanted to ask in sfdc forums first. I would have nothing to debug in Mulesoft, no events are logged in either the platform audit trail or the api logs themselves. The "service" I am using is sfdc external services and configured according to their own documentation. Apr 25 at 17:13
  • If you're sure that the request never reaches Mulesoft, then Named Credential or Mule/SF integration is a likely culprit. This is a fairly complex setup so our recommendation is to open a support case.
    – identigral
    Apr 25 at 17:17
  • Alright cool - I already have a support case open with salesforce so hopefully they are able to help troubleshoot. I'll also triple check I don't see any incoming requests to either mule platform or api itself. Thanks. Apr 25 at 17:20

1 Answer 1

1

For future reference here, I set up debug logs on myself and was able to find an issue with the named credential. Check out step 5 official sfdc documentation on setting up a named credential here: https://help.salesforce.com/s/articleView?id=sf.external_services_mulesoft_create_named_credential.htm&type=5. Step 5 instructs you to set up the named credential with URL https://anypoint.mulesoft.com. However, when I run the flow leveraging this ext. service/named cred and look at the debug logs, it looks like the external service combines my imported api endpoint (in this case /ping) with this URL such that the request is made to https://anypoint.mulesoft.com/ping. Here is the actual entry, note the Endpoint:

 09:25:25.57 (57193873)|NAMED_CREDENTIAL_REQUEST|NamedCallout[Named Credential Id=0XA0v0000018Tcj, Named Credential Name=muleCredTakeTwo, Endpoint=https://anypoint.mulesoft.com/ping, Method=GET, External Credential Type=EXTERNAL, HTTP Header Authorization=Method: Bearer - Authorization Credential Hash: 000000000, Content-Type=application/json; charset=UTF-8, Request Size bytes=-1, Retry on 401=True]

This is NOT the URL I need to make requests to. The url where the application is running looks like https://nonprod-api.mycompany.com/app-name-dev/api/v1/ping. I have not found the correct way to configure the URL as the official sfdc documentation is clearly missing something, however this is the source of the 301 error so this is the immediate answer to my issue.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.