1

I have a callout that retrieves information from an external rest API. We randomly started getting a bunch of failures:

client sent invalid header line: "SFDC_STACK_DEPTH: 1" while reading client request headers

Does anyone know why SFDC_STACK_DEPTH: 1 would have been set? I can't seem to find any documentation on it.

2

The SFDC_STACK_DEPTH header is automatically added by any request that is made from a Salesforce server.

It is used to prevent chaining of requests from one Salesforce server to another. Without such a mechanism threads could get blocked as they wait for other threads to complete. You could do things like chaining one anonymous Apex execution to another to work around other limits. So while you can make one level of calls from Salesforce to Salesforce, any further attempts will get blocked by the presence of the header.

See also:

| improve this answer | |
  • Yea. That's what I was thinking lol. – Eric Mar 25 '17 at 20:41
  • awesome, Not sure why the service randomly started throwing that error if this header is always present. Something else must have triggered the failure. Thanks as always – NSjonas Mar 26 '17 at 16:11

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.