question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Tables] Delete Entity Returning Unauthorized, Query Entities Not

See original GitHub issue
  • Package Name: azure-data-tables (reproducable in azure-cosmosdb-tables)
  • Package Version: 12.0.0b3
  • Operating System: Windows 10
  • Python Version: 3.8.6

Describe the bug After creating a TableClient from azure.data.tables.aio, a call to table_client.query_entities is successful. Just a few lines later, a call to table_client.delete_entity is not, and returns a ClientAutheniticationError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

I’ve tried this with azure.cosmosdb.table as well: Using similar calls, the query call is successful, but the delete call returns an AzureSigningError: Incorrect padding.

I have verified that the key is 88 characters long, ends with ==, and is DIRECTLY copied from the storage account in question. It obviously works for the query_entities call.

To Reproduce Steps to reproduce the behavior:

  1. Create an Azure Storage Account, add a table to it, and name the table “Locator”. Add a few entities with a column called LocatorHash, with any string value you like.
  2. Run the following code:
    from azure.data.tables.aio import TableClient
    from azure.core import MatchingConditions

    table_name = 'Locator'
    email_hash = '...' #Can be any string value contained in the LocatorHash column
    table_client = TableClient(account_url='https://<YOURACCOUNTNAME>.table.core.windows.net', table_name=table_name, credential=os.environ['STORAGE_ACCOUNT_ACCESS_KEY'])
    async with table_client:
        locator_entities = table_client.query_entities(filter=f"LocatorHash eq '{email_hash}'")
        coroutines = []
        async for locator_entity in locator_entities:
            logging.info(f"Deleting record: {locator_entity}")
            # error occurs on this line
            await table_client.delete_entity(row_key=locator_entity['RowKey'], partition_key=locator_entity['PartitionKey'], etag=locator_entity['_metadata']['etag'], match_condition=MatchConditions.Unconditionally)

Expected behavior Entities are deleted rather than receiving an AuthError.

Screenshots

When using azure.data.tables.aio image

When using azure.cosmosdb.table – note, had to edit code to be synchronous image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:22 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Dec 9, 2020

@seankane-msft I hate that this is a bug for you guys, but it is so validating to know that I’m not crazy!

1reaction
seankane-msftcommented, Dec 9, 2020

@sejohnson-at-griffis I was able to confirm what @annatisch hypothesized. Changing my RowKey to be foo@bar.com would fail on a delete. It also fails on a upsert_entity call, but will succeed on a create_entity. The get_entity was unsuccessful as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure october 2012 sdk - how to delete a table entity without ...
You'll need to use TableOperation.Delete : var storageAccount = CloudStorageAccount.DevelopmentStorageAccount; var table = storageAccount.
Read more >
Delete Entity (REST API) - Azure Storage - Microsoft Learn
The Delete Entity operation deletes an existing entity in a table.
Read more >
HTTP/1.1: Status Code Definitions
The entity returned with this response SHOULD include an indication of the request's current status and either a pointer to a status monitor...
Read more >
How to Build CRUD REST APIs with ASP.NET Core 3.1 and ...
NET Core 3.1 and Entity Framework, create a JWT, and secure APIs. ... following SQL query into the Query window to create necessary...
Read more >
Deleting roles or instance profiles - AWS Documentation
That way you don't have an unused entity that is not actively monitored or ... with (Service-linked role) in the Trusted entities column...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found