Skip to content

Autogenerated RowKey should be copied to $id for Tables API #26959

Open

Description

  • Package Name: @azure/cosmos
  • Package Version: 3.16.2
  • Operating system: N/A
  • nodejs
    • version:
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
When saving a Tables entity from Data Explorer without specifying a RowKew, SDK autogenerates a uuid and assigns it to "id" property. But it needs to set both "id" and "$id" with the RowKey value. The code in question can be found here: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosdb/cosmos/src/client/Item/Items.ts#L271

To Reproduce
Steps to reproduce the behavior:

  1. Log in to a Tables API account in Azure portal.
  2. Open Data Explorer.
  3. Create a table.
  4. Create an entity. Specify a partitionKey but NOT a rowKey.
  5. In another SDK attempt to fetch the created entity.

Expected behavior
The created entity should be fetched.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
I believe Tables is somewhat unique in that it relies on the "$id" property to find documents as opposed to just the "id" field. Apparently Tables API fetches the entity fine when partitionKey is specified and rowKey is not. But I think, for completeness' sake, the uuid should be copied to "$id" at all times. You can confirm with Tables team.
For full context, see ICM https://portal.microsofticm.com/imp/v3/incidents/details/413947404/home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Cosmos

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions