1

REST Requests seem to be rejected by SF since Winter 23 hit our preview enabled sandbox.

Below sample code runs (run on Exec. anonymous) smoothly in v54 sandbox, but fails with below error in v55 (Winter 23) sandbox.

HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setEndpoint('callout:serviceContract/services/apexrest/GenerateContract/*');
req.setHeader('Content-Type', 'application/json;charset=UTF-8');
req.setBody('{"orientationId":"a1jp0000000xvGSAKY"}');
HTTPResponse res = new Http().send(req);
System.debug('body>> '+res.getBody());
System.debug('status>> '+res.getStatus());

System.debug('getHeaderKeys()>> '+res.getHeaderKeys());
System.debug('getStatusCode()>> '+res.getStatusCode());
System.debug('str>> '+res.toString());

Dev Console logged corresponding debug lines in v55 (Winter 23): enter image description here

Any help to firgure out what new restriction/feature causing this issue? and any suggestions to workaround please? Thanks in advance.

1
  • Could you please add the configuration of your named credential? Due to enhanced domains been enforced in the lastest release, I'm pretty sure you have an outdated endpoint, should be in this format. orgName--sandboxName.sandbox.my.salesforce.com
    – mnunezdm
    Commented Aug 29, 2022 at 11:51

1 Answer 1

5

Due to enhanced domains been enforced in the Winter 23 release, the hostnames have been updated

From

orgName--sandboxName.my.salesforce.com

To

orgName--sandboxName.sandbox.my.salesforce.com

I assume that in your named credential configuration (serviceContract) you have the old format instead of the new one. Try updating it

Enhanced Domain Documentation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .