NodeJS Azure Function with Event Grid在本地运行而不使用ngrok

k5ifujac  于 11个月前  发布在  Node.js
关注(0)|答案(1)|浏览(85)

我有一个应用程序,使用AzureFunction和EventGrid与Nodejs。我想在localhost中调试一些事件触发器函数,但由于特殊原因,我不想使用Ngrok。还有其他方法可以在不使用Ngrok的情况下实现EventGrid调试吗?

dojqjjoe

dojqjjoe1#

在本地运行Azure函数时,可以通过以下URL访问EventGridTrigger:

http://localhost:7071/runtime/webhooks/EventGrid?functionName={functionname}

字符串
对于Postman(例如),您将需要这些额外的头:

*内容类型application/json
*aeg-event-typeNotification

一个完整的http请求看起来像这样

POST /runtime/webhooks/EventGrid?functionName={functionname}
Host: http://localhost:7071
Content-Type: application/json
aeg-event-type: Notification

{
  "topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/test/providers/Microsoft.EventHub/namespaces/test",
  "subject": "eventhubs/test",
  "eventType": "captureFileCreated",
  "eventTime": "2017-07-14T23:10:27.7689666Z",
  "id": "7b11c4ce-1c34-4416-848b-1730e766f126",
  "data": {
    "fileUrl": "https://test.blob.core.windows.net/debugging/testblob.txt",
    "fileType": "AzureBlockBlob",
    "partitionId": "1",
    "sizeInBytes": 0,
    "eventCount": 0,
    "firstSequenceNumber": -1,
    "lastSequenceNumber": -1,
    "firstEnqueueTime": "0001-01-01T00:00:00",
    "lastEnqueueTime": "0001-01-01T00:00:00"
  },
  "dataVersion": "",
  "metadataVersion": "1"
}


x1c 0d1x的数据


相关问题