Skip to content

Conversation

@hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented May 10, 2024

The extension obtains the connection string by getting the corresponding environment variable / App Setting. If the connection string variable name is not an app setting, the connection property is set to None. When creating a client type and the connection is None, the azure-storage-blob sdk throws an error saying: AttributeError("'NoneType' object has no attribute 'rstrip'").

This is not a clear error, so this adds validation on the connection string in the extension side. If the connection is None, an error will be thrown saying ValueError('Storage account connection string NAME does not exist. Please make sure that it is a defined App Setting.')

The purpose of this PR is not to perform validation on the connection string object. The sdk already does this. The goal of this is to improve the error in the specific case where the connection string is formatted correctly but does not have corresponding value set.

  • If the provided connection variable exists but its corresponding connection string value is invalid, the sdk will throw an error saying ValueError('Connection string missing required connection details.')
  • If the provided connection string is invalid (eg. contains invalid characters, empty, or whitespace), the sdk will throw an error saying ValueError: Connection string is either blank or malformed..

@hallvictoria hallvictoria marked this pull request as ready for review May 10, 2024 21:18
@hallvictoria hallvictoria merged commit 0bd61fb into dev Aug 16, 2024
@hallvictoria hallvictoria deleted the hallvictoria/invalid-connection-string branch August 16, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants