azure-storage table服务无法解析 [英] azure-storage table services not resolving
问题描述
我创建了一个存储并获得了我的存储名称和密钥,我创建了一个azure函数,它使用azure-storage模块连接到存储。但是,表服务似乎没有响应/解决。下面是关于天蓝色函数的代码。
Hi, I created a storage and got my storage name and key, I created an azure function that uses azure-storage module to connect to the storage. however, the table services does not seem to respond/resolve. below is my code on azure functions.
const jwt = require('jsonwebtoken');
const jwt = require('jsonwebtoken');
const config = require('./../ config')
const config = require('./../config')
const azure = require('azure-storage');
const azure = require('azure-storage');
require ('dotenv')。config();
require('dotenv').config();
const tableService = azure.createTableService(**** storageAccountNumber ****,*** storageAccessKey *****);
const tableService = azure.createTableService(****storageAccountNumber****,***storageAccessKey*****);
const uuid = require('uuid / v1');
const uuid = require('uuid/v1');
module.exports = async function(context,req){
module.exports = async function (context, req) {
  context.log('JavaScript HTTP触发器功能处理了请求。');
context.log('JavaScript HTTP trigger function processed a request.');
      var item = {
var item = {
          " 123":" CHANGED",
"123":"CHANGED",
          " harhar":" asda"
"harhar":"asda"
      };
      item [" PartitionKey"] =" Partition";
item["PartitionKey"] = "Partition";
      item [" RowKey"] = uuid();
item["RowKey"] = uuid();
      context.log("在调用表格服务之前");
context.log("before calling table service");
      tableService.insertEntity('mytable',item,{echoContent:true},function(错误,结果,响应){
tableService.insertEntity('mytable',item,{ echoContent: true },function (error, result, response) {
; context.log("表格服务回拨");
context.log("table service call back");
if(!error){
if (!error) {
context.log(" success create entry" ;);
context.log("successful create entry");
//这将返回201代码+内部的数据库响应正文
// This returns a 201 code + the database response inside the body
//这样的调用状态会自动触发context.done()
// Calling status like this will automatically trigger a context.done()
// context.res.status(201).json(response);
//context.res.status(201).json(response);
context.res = {
context.res = {
       
状态:201,
status: 201,
                 
正文:{"结果":"结果"}
body: {"result":"result"}
              };
              context.done();
context.done();
          }其他{
              context.log("创建条目错误");
context.log("error creating entry");
              //如果出现错误,我们会返回相应的状态代码以及数据库返回的错误
// In case of an error we return an appropriate status code and the error returned by the DB
              context.res = {
context.res = {
                 
状态:401,
status: 401,
                 
正文:{错误:错误}
body: {error:error}
              };
              context.done();
context.done();
          }
      });
};
我确定存储名称和密钥是正确的。天蓝色功能甚至没有进入回叫, context.log("表服务回调");没有执行
。我认为这可能是一个网络问题,但是再次将其部署为azure函数,因此网络应该不是问题。任何能提供帮助的人都将不胜感激,谢谢!
Im sure the storage name and key are correct. The azure function does not even go into the call back, context.log("table service call back"); is not being executed. I thought this might be a network issue, but then again this is already deployed as an azure function so network shouldn't be an issue. Anyone who can help would be greatly appreciated, thanks!
推荐答案
为延迟道歉!只是为了澄清:您是否参考了此文章<中提出的建议? / a>
你能分享一下代码结果的屏幕截图(错误代码或错误信息)吗?
这篇关于azure-storage table服务无法解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!