Skip to content
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

Unclear error message when using a SAS Token that already has api-version defined in it #259

Closed
gmantri opened this issue Apr 12, 2016 · 2 comments
Assignees
Milestone

Comments

@gmantri
Copy link

gmantri commented Apr 12, 2016

If I try to create an instance of StorageCredentials class with a SAS Token that already has api-version defined into it, I get following error:

An item with the same key has already been added.

I believe this is because UpdateQueryBuilder method doesn't check if this parameter is already defined in the query string and tries to add it nonetheless.

    private void UpdateQueryBuilder()
    {
        SasQueryBuilder newQueryBuilder = new SasQueryBuilder(this.SASToken);

        newQueryBuilder.Add(Constants.QueryConstants.ApiVersion, Constants.HeaderConstants.TargetStorageVersion);

        this.queryBuilder = newQueryBuilder;
    }

Please see this thread on StackOverflow for more details: http://stackoverflow.com/questions/36579561/how-can-i-call-new-azurestoragecontext-using-sastoken-instead-of-storageaccoun.

@pemari-msft
Copy link
Member

We should indeed update the error message to make it clearer, and we'll add that as a work item. However, the api-version parameter is owned by the component making the call, and so, we do intend to throw if that is present (the other option is to silently replace it with our own, which seems disingenuous).

@pemari-msft pemari-msft changed the title Bug with StorageCredentials when using a SAS Token that already has api-version defined in it Unclear error message when using a SAS Token that already has api-version defined in it Apr 12, 2016
@pemari-msft pemari-msft added this to the 8.0 milestone Oct 10, 2016
erezvani1529 added a commit to erezvani1529/azure-storage-net that referenced this issue Dec 21, 2016
-- Mocking methods that return a sealed class Azure#335
-- Mocking CloudBlobContainer Azure#318
-- Finding it hard to mock some of the Storage classes Azure#349
-- Unclear error message when using a SAS Token that already has `api-version` defined in it Azure#259
-- ListBlobs() > Missing mandatory parameters for valid Shared Access Signature Azure#352
-- .NET Core TableEntity is throwing a storage exception on derived class properties Azure#341
-- Content-Disposition header not persisted on blob upload Azure#353
-- Request: Expose specific TableOperation properties Azure#111
-- TableOperation expose Entity Azure#358
@erezvani1529
Copy link
Contributor

Hi @gmantri,

The error message has been improved to include relevant details for the above scenario in [8.0 release].(https://www.nuget.org/packages/WindowsAzure.Storage/8.0.0)

Thanks!

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

No branches or pull requests

3 participants