I'm debugging an issue where our customer's iOS app (which makes REST API calls to Salesforce via the SDK) is encountering data sync errors. We believe the API is returning error messages but they are not properly surfacing in the iOS app.

I tried enabling a trace flag for the user in question, using the default SFDC_DevConsole logging level. What I saw was, only the successful CRUD operations generated debug logs. The ones that failed did not generate any log at all so I could not see the error messages from the Salesforce side.

I tested this out manually as well. I started a trace flag on myself, opened up Workbench, and made a successful REST API call that updated a Contact. I could see a debug log for that one. Then I tried some bad calls: one that attempted to update a nonexistent field, and another that attempted to update an Email field with an invalid Email address. In both cases I got an error back from the API, but neither operation generated a Debug log.

Is there any way to get logs of these errors from the Salesforce side or can the logs only be known from the iOS side?

  • Is it Apex Rest or Standard SF rest? – Pranay Jaiswal Feb 21 at 16:27
  • Standard REST API CRUD calls, mediated by the Salesforce iOS SDK. – Charles T Feb 21 at 18:57

Depending on how the call fails, it is entirely possible you wouldn't see a debug log. For example, if you don't have a session ID, the JSON or XML is improperly formatted, the user's session has expired, etc. A request needs to get all the way through the pre-execution validations before you can get a debug log. In these cases, you're probably going to be stuck debugging your application from the client side. You may also be able to get help from support if you have a specific call that failed; all calls to Salesforce exist in a log somewhere, even failed calls, but only those that pass all the security checks would be available in your org.

  • "pre-execution validations" - now that's a new phrase for me. Do you have a source where I can read more about that? Anyway we're going to improve logging on the app side but I wanted to be sure I wasn't missing anything. – Charles T Feb 21 at 18:59
  • @CharlesT It's not standard nomenclature, I don't think, just words I threw together. Basically, up until the part of the log that says "EXECUTION_STARTED", there's a bunch of stuff that happens. Salesforce verifies the session is valid, the request is well-formed, etc (all the stuff I said in this answer). I am pretty sure there used to be such a document, but I have not seen it in a while. Just know that there is a minimum level of "correctness" within your request before it can even start a debug log. – sfdcfox Feb 21 at 19:06

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.