-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ingest/salesforce): helpful error messages on failure #11266
feat(ingest/salesforce): helpful error messages on failure #11266
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@@ -287,7 +287,13 @@ def __init__(self, config: SalesforceConfig, ctx: PipelineContext) -> None: | |||
|
|||
except Exception as e: | |||
logger.error(e) | |||
raise ConfigurationError("Salesforce login failed") from e | |||
if "API_CURRENTLY_DISABLED" in str(e): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string will be present only if the Exception
is actually:
simple_salesforce.exceptions.SalesforceAuthenticationFailed
maybe we can catch is explicitly?
error = "Salesforce login failed. Please make sure user has API Enabled Access." | ||
else: | ||
error = "Salesforce login failed. Please verify your credentials." | ||
"Please set `is_sandbox: True` in recipe if this is sandbox account." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second part of this message might be missleading in case somebody really provided wrong credentials. Maybe we could only add is_sandbox
info if the instance_url
somehow falls into the regular expression by ending somehow like: .sandbox.my.salesforce.com
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure if salesforce sandbox url follows any specific structure. Do you have any resource that confirms that instance url can be used to identify whether this is sandbox account ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like its general pattern to use "sandbox" in name, so in favour of best practice, will change this handling to check whether "sandbox" is present in url, before showing this message.
try: | ||
sObjects = self.get_salesforce_objects() | ||
except Exception as e: | ||
if "sObject type 'EntityDefinition' is not supported." in str(e): | ||
# https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_entitydefinition.htm | ||
raise ConfigurationError( | ||
"Salesforce EntityDefinition query failed. " | ||
"Please verify if user has 'View Setup and Configuration' permission." | ||
) from e | ||
raise e | ||
else: | ||
for sObject in sObjects: | ||
yield from self.get_salesforce_object_workunits(sObject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good, left some comments about clarification of error messages trigger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Checklist