【发布时间】:2019-04-29 07:56:11
【问题描述】:
我有一个 azure 函数,它发出基于承诺的 http post 请求并得到响应;现在我想将此响应发送到服务总线和不同的事件中心(天蓝色功能由不同的事件中心触发)。
函数表示在事件中心的情况下它已成功执行,但没有发送任何事件。
在服务总线的情况下,我收到此错误NamespaceConnectionString should not contain EntityPath.
module.exports = async function (context, eventHubMessages) {
context.log(`JavaScript eventhub trigger function called for message array ${eventHubMessages}`);
var completeData = '';
eventHubMessages.forEach((message, index) => {
context.log(`Processed message ${message}`);
completeData = message;
});
var output = '';
const axios = require('axios');
try {
const response = await axios.post('http://fake-endpoint',
{ data-json : completeData
})
context.log(`statusCode: ${response.statusCode}`);
context.log(response.data);
output += response.data;
var time = new Date().toString();
context.log('Event Hub message created at: ', time);
context.bindings.outputEventHubMessage = out;
context.bindings.outputSbMsg = out;
context.done()
return response.data; // or return a custom object using properties from response
} catch (error) {
// If the promise rejects, an error will be thrown and caught here
context.done(error);
}
};
预期输出:成功执行;可在服务总线和事件中心接收的数据。
实际输出:Error: NamespaceConnectionString should not contain EntityPath.
【问题讨论】:
-
你的连接字符串有实体路径吗?如果可以,您可以尝试删除它吗?
-
连接字符串通常由ARM模板动态生成。
标签: node.js azure-functions httpresponse azureservicebus azure-eventhub