Azure / azure-event-hubs-node

Node client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
MIT License
50 stars 46 forks source link

Azure function not always triggered when an event is sent to event hub event stream #214

Closed secureaiexplorer closed 5 years ago

secureaiexplorer commented 5 years ago

Describe the bug I have configured an event hub to export Activity Logs. I am using the following event hub trigger function to receive the events from event hub:

module.exports = function (context, eventHubMessages) {
    context.log(`JavaScript eventhub trigger function called for message array ${eventHubMessages}`);

    eventHubMessages.forEach((message, index) => {
        context.log(`Processed message ${message}`);
        context.log(`EnqueuedTimeUtc = ${context.bindingData.enqueuedTimeUtcArray[index]}`);
        context.log(`SequenceNumber = ${context.bindingData.sequenceNumberArray[index]}`);
        context.log(`Offset = ${context.bindingData.offsetArray[index]}`);
    });

    context.done();
};

To create an activity log I change the tags for the Resource group. Problem I am debugging is that I see the EventHubs stats incrementing when a new activity log is generated but I don't see the trigger function always being called. Is there any recommendation on how do I go about debugging this issue given that event hub does see the messages.

My bindings:

{
  "bindings": [
    {
      "type": "eventHubTrigger",
      "name": "eventHubMessages",
      "direction": "in",
      "eventHubName": "insights-operational-logs",
      "connection": "xxxxxx_RootManageSharedAccessKey_EVENTHUB",
      "cardinality": "many",
      "consumerGroup": "$Default"
    }
  ]
}

To Reproduce Issue is not consistently reproducible but I hit the issue couple of times during half a day of testing yesterday.

secureaiexplorer commented 5 years ago

hit this issue again today. got the first activity log after I made some changes to Azure function. But subsequent Activity logs did not coming. Getting these messages:

2019-05-30T18:11:15 No new trace in the past 22 min(s). 2019-05-30T18:12:15 No new trace in the past 23 min(s).

When I check Activity Logs last update was 16 minutes ago:

Delete role assignment Succeeded 16 min ago Thu May 30 2019 10:55:16 GMT-0700 (PDT) Pay-as-you-go

Event Hubs instance also shows an incoming message and an outgoing message from 6 minutes ago but nothing shows up in the logs for EventHubTrigger

amarzavery commented 5 years ago

@mguglani - Can you let us know the name of the package and version of the package used?

@ramya-rao-a - Please take a look at this issue? Link to Azure Functions EH JS example.

BTW, should we close this repo to create issues and redirect customers to open an issue at https://github.com/azure/azure-sdk-for-js.

secureaiexplorer commented 5 years ago

@amarzavery Let me know if this is the information you are looking for or something else: Platform settings

Platform 32 Bit  Managed pipeline version Integrated  FTP state All allowed   FTP based deployment can be disabled or configured to accept FTP (plain text) or FTPS (secure) connections. Learn more HTTP version 1.1 

Here are the application settings:

WEBSITE_NODE_DEFAULT_VERSION - 10.4.1 FUNCTIONS_WORKER_RUNTIME - node FUNCTIONS_EXTENSION_VERSION ~2

amarzavery commented 5 years ago

@mguglani - I am looking for the name of the package. It would be either azure-event-hubs or @azure/event-hubs. I need to know the version of that package as well. "azure-event-hubs" is the old package and is replaced by "@azure/event-hubs" and has lot of bug fixes. So make sure you are using that package in your Azure Function web app. I think if you can remote ssh or login to the vm/container that hosts your Azure Function and then see the node_modules folder over there, then you can find the package being used.

secureaiexplorer commented 5 years ago

can I get this information from console (remote ssh does not work. see below)? Check "ls" output from console. Let me know where do I find the node_modules folder?

D:\home\site\wwwroot\EventHubTrigger1> ls -alrt total 4 drwxr-xr-x 1 Unknown+User Unknown+Group 0 May 14 00:11 .. drwxr-xr-x 1 Unknown+User Unknown+Group 0 May 14 00:30 . -rw-r--r-- 1 Unknown+User Unknown+Group 324 May 15 00:49 function.json -rw-r--r-- 1 Unknown+User Unknown+Group 2113 May 31 08:52 index.js

D:\home\site\wwwroot> ls EventHubTrigger1 HttpTrigger1 bin extensions.csproj host.json

remote ssh does not work:

az webapp ssh --subscription "xxx-xxx-xxx-xxx-xxx" --resource-group -n Only Linux App Service Plans supported, Found a Windows App Service Plan

amarzavery commented 5 years ago

I do not have proper understanding of how Azure Event Hub works in conjunction with Azure Functions. From the docs, I landed here, which makes me feel that they are using the .net AzureEventHubs package underneath and not the JS EventHubs package. If that is indeed the case, then filing an issue in the .net sdk would be the right thing to do.

May be @davidebbo from the Azure Web Apps team or @brettsam, @mathewc who are the main contributors to the web jobs sdk can provide some insights into this.

davidebbo commented 5 years ago

@amarzavery note that I am no longer on the team. But the other two people you mentioned are and may be able to help.

ramya-rao-a commented 5 years ago

@mguglani So to summarize

https://github.com/Azure/azure-webjobs-sdk/ is the reposiotry for the Event Hubs Triggers. Please log this issue there to get the right support.

This repository is for the @azure/event-hubs library which you would use in a nodejs app in order to interact with Event Hubs

ramya-rao-a commented 5 years ago

should we close this repo to create issues and redirect customers to open an issue at https://github.com/azure/azure-sdk-for-js

The README has already been updated. I just finished either moving or closing open issues here. Will archive this repo soon.