Azure Storage emulator with Nodejs createQueueService error

南笙酒味 提交于 2021-01-28 09:31:07

问题


I'm receiving the following error when I try connecting to the emulated storage queue service:

The MAC signature found in the HTTP request '...' is not the same as any computed signature.

Make sure the value of Authorization header is formed correctly including the signature.

This is the approach I'm using to connect to the azure storage:

    var storageAccount = 'devstoreaccount1'
    var accessKey= 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=='
    var azure = require('azure-storage');
    var queueSvc = azure.createQueueService(storageAccount,accessKey);

    queueSvc.createMessage('myqueue', "Hello world!", function(error, results, response){
      if(!error){
        // Message inserted
      }
    });

I also tryed using the following connection strings, without success:

UseDevelopmentStorage=true

and

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;
QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;

Everything is working properly in production environments, the issue is only related to the emulated service and specifically for the queues (emulated blobs are working as expected).

Any idea?


回答1:


I have reproduced your error after testing your code with SDK 2.8.1.

I get detailed log from console by using queueSvc.logger.level = azure.Logger.LogLevels.DEBUG;. The request uri generated by this method is https://devstoreaccount1.queue.core.windows.net:443/myqueue/messages, which is used to access storage account online called devstoreaccount1.

To access storage emulator:

var azure = require('azure-storage');
var devStoreCreds = azure.generateDevelopmentStorageCredentials();
var queueSvc = azure.createQueueService(devStoreCreds);


来源:https://stackoverflow.com/questions/49700569/azure-storage-emulator-with-nodejs-createqueueservice-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!