1

I'm attempting to use this microsoft azure node.js SDK to work with blob storage and to simply upload a file.

When I run this same code on a windows 7 machine, the service is able to authenticate correctly and the image is uploaded. Both windows 8 machine and windows 7 machine are running node v.0.12.2 but the windows 8 machine generates the error around the request date header being too old. It seems like it's using my system time as GMT and the azure service is authenticating in my time zone or something??

Code:

var azure = require('azure-storage');
var blobService = azure.createBlobService(myStorageAccount, myAccessKey);
blobService.createContainerIfNotExists('testzies', {publicAccessLevel : 'blob'}, function(error, result, response){

});
blobService.createBlockBlobFromLocalFile('testzies', 'first', 'C:/temp/sample.jpg', function(error, result, response){

});

Error, only on the windows 8 machine:

{ [Error: Forbidden] } { [Error: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. code: 'AuthenticationFailed',
authenticationerrordetail: 'Request date header too old: \'Fri, 22 May 2015 02:56:35 GMT\'', statusCode: 403 }

Buchannon
  • 1,671
  • 16
  • 28
  • Suggest looking at this SO post on how to set timezone explicitly in your code: http://stackoverflow.com/questions/8083410/how-to-set-default-timezone-in-node-js. If this doesn't fix the issue then maybe there is a slight clock skew on your Win8 machine (i.e. timzone is right but the actual time is wrong). – Simon W May 23 '15 at 04:06

1 Answers1

0

I found the answer to my own question here.

  • Double click clock bottom right
  • change date and time settings -> "internet time" tab -> "change settings"
  • Change internet time server to "time.nist.gov" (mine was set on "time.windows.com")
Buchannon
  • 1,671
  • 16
  • 28