TableService.insertOrReplaceEntity doesn't work #13

bergie opened this Issue Dec 16, 2011 · 6 comments


None yet
2 participants

bergie commented Dec 16, 2011

I'm using TableStorage for storing server access logs in my Azure CoffeeScript tutorial. I also have a worker process that calculates access counts per URL.

To make this idempotent, I'm using a modified URL as the RowKey, and tried to use insertOrReplaceEntity. That always failed so I had to rewrite my code as:

countRequests url, (total) ->
  key = "url-#{url.replace('/', '-')}"
  totalEntry =
    total: total
    RowKey: key
    PartitionKey: 'totals1'
  table.insertEntity 'requestTotal', totalEntry, (error) ->
    return unless error
    table.updateEntity 'requestTotal', totalEntry, (error) ->
      console.log "Failed to update request count for #{url} to #{total}", error if error

Hi Bergie,

Could you give me more detail about the issue ? The method does work, but you're probably hitting some limit with it. Are you sure the values you tried for RowKey / Partition key were unique and valid ?

Also, what error did you get ?

bergie commented Dec 16, 2011

Sorry, I don't have access to a Windows computer anymore, so I can't get the error to you. But basically: with the code above (URL being /), using insertOrReplaceEntity failed always, while the combo of insertEntity and updateEntity worked reliably.

So... if url is '/' the resulting RowKey would be "url--" i assume. I just tried:

  var entity = {
    total: 1,
    RowKey: 'url--',
    PartitionKey: 'totals1'

  tableService.insertOrReplaceEntity(tableName, entity, function (error2) {

and it worked fine...

Btw, as a side note, the libs should work just as well on a non-win machine. :)

If you get further details about this, with error information please reactivate the bug. I'll investigate a bit further but don't see anything obvious from your description... :-(

@andrerod andrerod closed this Dec 16, 2011

bergie commented Dec 16, 2011

The issue came with the Azure emulator, with azure installed from NPM, if that affects this.

andrerod pushed a commit that referenced this issue Oct 24, 2012

andrerod pushed a commit that referenced this issue Apr 3, 2014

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