I observed the following exception in the logs a few days ago:
---> Azure.RequestFailedException: The property value exceeds the maximum allowed size (64KB). If the property value is a string, it is UTF-16 encoded and the maximum number of characters should be 32K or less.
RequestId:fb842d88-5002-002e-363f-1342d7000000
Time:2024-09-30T13:50:16.5210829Z
Status: 400 (Bad Request)
ErrorCode: PropertyValueTooLarge
This exception has a few issues:
- It does not tell which property which is too long.
- The message is wrong if the property is
PartitionKey
orRowKey
.
Worse, the documentation is also incorrect:
RowKey Property
(...)
The row key is a string value that may be up to 1024 characters in size.
There is a difference between characters and bytes. If the text is UTF-16, the limit is 512 characters.
It took me long enough to narrow down the issue, which was RowKey
being too long.
My solution:
- Generate the candidate key, may be too long with invalid characters
- Create a
Crc32
hash and prepend to the candidate - Truncate this to max 512 characters
The hash will ensure a unique RowKey
in case two truncated candidates should be the same.
Top comments (0)