Storage throws 500 when cosmosDB returns 413
PUT /api/storage/v2/records API accepts and tries processing the request when the record count in the request is less than 500. The issue arises when the record count is less than 500, but metadata size is more than 2 MB. In this case, storage service tries to upsert all metadata of the records at once to osdu-db using CosmosStoreBulkOperations. However cosmos DB returns 413 Entity too large as the document size in the request exceeded the max allowable document size of 2 MB, and storage converts this exception into 500. As a result, user gets 500 though they are still within the known limit of 500 records, and the storage service's availability goes down.
