0

I am working with a client who is having their instance migrated to another pod. As part of our preparations, we want to test how integrations will behave when the org goes into read-only mode.

As a first step, we asked Salesforce support to enable read-only test mode in a couple of our sandboxes. Unfortunately, when trying to enable read-only mode in a sandbox we get a "Feature is currently unavailable at this time. Please try again later." which is not helpful at all. Salesforce support is looking into it, but not expecting anything useful back.

If others have had issues testing read-only mode in a sandbox or even better got a similar error message when trying to enable read-only mode in a sandbox then I would love to hear from you.

However, my main question is that based on the read-only mode overview article we can expect the following error code returned from the Salesforce API

INSERT_UPDATE_DELETE_NOT_ALLOWED_DURING_MAINTENANCE

I wanted to know if the HTTP Response Code would be 500 in this instance? It is not 100% clear based on both the article above and status codes and error responses guide

I know there is a similar question already but that did not get any traction, hence asking again.

2

Presumably, it would be a 503 Service Not Available error, not a 500 Internal Server Error code. Regardless, I think it would be safe to say that one should be parsing the resulting JSON/XML response for an errorCode of INSERT_UPDATE_DELETE_NOT_ALLOWED_DURING_MAINTENANCE rather than relying on a status code. I would expect to see a code in the 5xx range, which indicates that you cannot retry your request because a server condition can't be met. Any existing code you have should already be able to detect that a 5xx error occurred and be able to report it to an API client, presuming one follows best practices for writing API integrations. In any language that you'd use, the code would basically work like this:

if(httpResponse.statusCode() >= 500) {
  throw new Exception('Unable to perform action because of the error: '+httpResponse.statusCode()+': '+httpResponse.status());
}

Actual differences in languages will alter the code you need, but just be aware that 4xx and 5xx errors should already be handled in your code, and no "special" logic should be needed to take care of the situation.

| improve this answer | |
  • Thanks. I think you might be right. I'll be sure to update this once the migration happens. Even 503 doesn't fit 100%, given that the service is available, provided you are just querying and not writing to the database. – Mahat Hussein Jan 13 at 14:25

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.