Loading
Salesforce から送信されるメールは、承認済ドメインからのみとなります続きを読む

Script-thrown exception" error on HTTP callouts to AWS as of Spring ’22

公開日: Jul 14, 2023
説明
In Spring ’22, we switched the internal HTTP client implementation for AWS callouts using Named Credentials for a mixture of security and performance reasons. As a result, customers may need to handle certain HTTP headers differently.
In Winter ’22 and earlier, the the Content-Length header was silently ignored even when specified explicitly in customers' Apex code. In Spring ’22, the header is not ignored, and causes issues regardless of whether or not the value matches the actual length of the content. Hence, callouts to AWS may fail with a "System.CalloutException: Script-thrown exception" when the Content-Length header is specified in the code.

Affected Code:
--
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:aws');
req.setMethod('POST');
req.setBody('dummy');
req.setHeader('Content-Length','5');
HTTPResponse res = new Http().send(req);
--
解決策
Remove or comment out the statement to set the Content-Length header.
--
// req.setHeader('Content-Length','5');
--
ナレッジ記事番号

000393013

 
読み込み中
Salesforce Help | Article