External third party service is occasionally getting Server returned HTTP response code: 500 when it does a POST to salesforce webservice class, but only occasionally. Most of the times it is working fine.

URL:https://domainurl/services/apexrest/classname . Here, domainurl is a public site url.Hence, whenever this webservice gets executed, it always gets executed by the same `Guest USER'

How can I debug such error especially when everything works out I am trying to post. AND Is there any way I can make a log in salesforce whenever such error is sent out?

  • ask the 3rd party service if it is possible to log requests that get a http 500 error and retry those requests with the debug logs enabled. That should give you more insight of what is happening in your webservice
    – Gilhil
    Jun 5, 2018 at 13:25

1 Answer 1


As this seems to be a Lightning Platform error (see "status codes and error responses"), I'd definitely open a support case. Maybe you're lucky and they are able to log something. Be sure to tell them the time such an error occurred.

I had a hard time logging webservice communication in Salesforce as it basically doesn't exist (apart from Login Logs) and even the Support wasn't able to access anything useful apart from apex class logs.

  • Hey @Schnaps, can you tell me more about how it is a Lightning Platform Error. I actually didn't understand this point.
    – devforce
    Jun 5, 2018 at 11:42
  • 1
    Salesforce has several http error codes for different api's. The ones for rest api can be found here [link ](developer.salesforce.com/docs/atlas.en-us.api_rest.meta/…). But you should definitely internet-search the phrase, as the meaning of the code depends on the what api exactly you are using. But in any case I'd let Salesforce know, that their integration debugging options are highly underdeveloped.
    – Schnaps
    Jun 5, 2018 at 12:02
  • Thanks. I will raise a Salesforce support ticket and hope they have something on their side.
    – devforce
    Jun 5, 2018 at 13:02
  • Did you support case lead to something useful?
    – Schnaps
    Oct 23, 2018 at 13:14

You must log in to answer this question.

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