0
votes

I am trying to retrieve an entity from an Azure Table Storage by PartitionKey and RowKey. This works great when there actually is an entity in my table with these keys.

tableService.retrieveEntity(tableName, partition, row, (err, res, resp) => {
    ...    
}

However, when no entity with for keys is found, I just get a rather unclear error saying "One of the request inputs is not valid"...

Unhandled rejection StorageError: One of the request inputs is not valid.

Is there any way to check if an entity exists for a specific Partition- and RowKey?

1
If the entity is not present, then you should get 404 (Not Found) error and not the one you're getting. The error you're getting indicates there's something wrong with the values you're providing. Can you share an example of PartitionKey and RowKey you're providing when you get this error?Gaurav Mantri
I was actually using disallowed characters in my RowKey parameter. Thanks for the heads-up.Schaemelhout

1 Answers

2
votes

I tried your code to retrieve the entity that does not exist, then I get the following error:

{ ...
  name: 'StorageError',
  message: 'The specified resource does not exist.\nRequestId:c9f87517-0002-0028-5e32-660f88000000\nTime:2017-01-04T02:30:10.0502844Z',
  code: 'ResourceNotFound',
  statusCode: 404,
  requestId: 'c9f87517-0002-0028-5e32-660f88000000' }

When I insert an entity with the wrong date, the code looks something like:

var task = {
  PartitionKey: {'_': 'hometasks'},
  RowKey: {'_': '1'},
  description: {'_': 'take out the trash'},
  dueDate: {'_': 'somethingwronghere', '$': 'Edm.DateTime'}
};

tableSvc.insertEntity('mytable',task, function (error, result, response) {
  console.log(error);
});

Then I get the same error below as yours:

 { ...
  message: 'One of the request inputs is not valid.\nRequestId:2e8e6c07-0002-003a-7135-663b94000000\nTime:2017-01-04T02:49:02.8761981Z',
  code: 'InvalidInput',
  statusCode: 400,
  requestId: '2e8e6c07-0002-003a-7135-663b94000000' }

So please double check whether you got the corresponding error message.