Azure-webjobs-sdk: ServiceBusTrigger doesn't work on azure function with .net library 2.0

Created on 27 Oct 2017  路  3Comments  路  Source: Azure/azure-webjobs-sdk

Hi All, I am trying to integrate Azure function with ServiceBusTrigger using .net library 2.0. However I keep getting error message of "HttpTrigger: Object reference not set to an instance of an object."

I desperately need help resolving this issue, any suggestions and pointers will be appreciated.

Provide the steps required to reproduce the problem

  1. function.json

    {
    "bindings": [
    {
    "name": "Asncreate",
    "queueName": "serviceBus",
    "connection": "AzureServiceBusCredential",
    "accessRights": "listen",
    "type": "serviceBusTrigger",
    "direction": "in"
    }
    ],
    "disabled": false,
    "scriptFile": "../bin/Core.dll",
    "entryPoint": "Core.HttpTrigger.Run"
    }

  2. local.settings.json

{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName= ;AccountKey= ",
"AzureServiceBusCredential": "Endpoint=sb://blablabla.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=="
}
}
sensitive information is removed.

  1. I just used the common code sample provided on Microsoft.

Actual behavior

[10/26/2017 10:10:52 PM] Reading host configuration file
Debug\netstandard2.0\host.json'
[10/26/2017 10:10:52 PM] Host configuration file read:
[10/26/2017 10:10:52 PM] {}
[10/26/2017 10:10:52 PM] error AF003: Missing a trigger argument named 'Asncreate'.
[10/26/2017 10:10:52 PM]
[10/26/2017 10:10:52 PM] Function compilation error
[10/26/2017 10:10:52 PM]
[10/26/2017 10:10:52 PM] error AF003: Missing a trigger argument named 'Asncreate'.
[10/26/2017 10:10:52 PM]
[10/26/2017 10:10:52 PM] Generating 0 job function(s)
[10/26/2017 10:10:52 PM] Starting Host (HostId=123123-495642060, Version=2.0.11308.0, ProcessId=8560, Debug=False, Attempt=0)
[10/26/2017 10:10:52 PM] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
[10/26/2017 10:10:52 PM] Job host started
[10/26/2017 10:10:52 PM] The following 1 functions are in error:
[10/26/2017 10:10:52 PM] HttpTrigger: Object reference not set to an instance of an object.
[10/26/2017 10:10:52 PM]
[10/26/2017 10:10:52 PM]
Listening on http://localhost:7071/
Hit CTRL-C to exit...
[10/26/2017 10:10:53 PM] Host lock lease acquired by instance ID '0000000000000000000000009767A036'.

Known workarounds

there is no known workaround.

Related information

Provide any related information


netstandard2.0




Most helpful comment

I have the same problem. It seems some packages are missing, like: Microsoft.Azure.WebJobs.ServiceBus.

All 3 comments

I have the same problem. It seems some packages are missing, like: Microsoft.Azure.WebJobs.ServiceBus.

I see the same problem with a javascript function. As @alikashanian mentions, I'm certain this is because of missing packages, and it might simply be a doc issue (i.e. instructions for getting this working are missing).

I have two functions:

  1. an HTTPTrigger that posts to Service Bus
  2. a SBTrigger that reads from a queue.

The first of these doesn't generate any errors, but doesn't actually post to the queue either.

The second reports the error seen by others.

Note: I've tried this on both Mac and Windows, and see the same issue.

Here are the details of the 2nd of these functions (the one that generates the "Object not set..." error during startup...

function.json:

{
  "disabled": false,
  "bindings": [
    {
      "name" : "myQueueItem",
      "queueName" : "test_queue",
      "connection" : "SBQueueConnectionString",
      "accessRights" : "manage",
      "type" : "serviceBusTrigger",
      "direction" : "in"
  }
  ]
}

index.js:

module.exports = function (context, myQueueItem) {
    context.log('JavaScript queue trigger function processed work item', myQueueItem);
    context.done();
};

Error seen after running func host start:

```C:\Users*\AppData\Local\lxss\home*\function-with-servicebus>func host start

              %%%%%%
             %%%%%%
        @   %%%%%%    @
      @@   %%%%%%      @@
   @@@    %%%%%%%%%%%    @@@
 @@      %%%%%%%%%%        @@
   @@         %%%%       @@
     @@      %%%       @@
       @@    %%      @@
            %%
            %

[31/10/2017 16:37:29] Reading host configuration file 'C:\Users*\AppData\Local\lxss\home*\function-with-servicebus\host.json'
[31/10/2017 16:37:29] Host configuration file read:
[31/10/2017 16:37:29] { }
info: Worker.Node.39ff4adc-f2c7-4d6a-af42-f1c60771bf35[0]
Start Process: node --inspect=5858 "C:\Users**.azurefunctions\bin\workers\Node\distsrc\nodejsWorker.js" --host 127.0.0.1 --port 53991 --workerId 39ff4adc-f2c7-4d6a-af42-f1c60771bf35 --requestId 1e531f14-d75d-4654-b1c8-c9ad05176a6c
[31/10/2017 16:37:29] Generating 1 job function(s)
[31/10/2017 16:37:29] Starting Host (HostId=desktop0fdl9js-2120148494, Version=2.0.11308.0, ProcessId=5944, Debug=False, Attempt=0)
info[31/10/2017 16:37:30] Found the following functions:
: Worker.Node.39ff4adc-f2c7-4d6a-af42-f1c60771bf35[0]
Debugger listening on ws://127.0.0.1:5858/5f594885-4cf0-411a-a191-72a89587c3fb
info: Worker.Node.39ff4adc-f2c7-4d6a-af42-f1c60771bf35[0]
For help see https://nodejs.org/en/docs/inspector
[31/10/2017 16:37:30] Host.Functions.createQueueItem
[31/10/2017 16:37:30]
[31/10/2017 16:37:30] Job host started
[31/10/2017 16:37:30] The following 1 functions are in error:
[31/10/2017 16:37:30] processQueueItem: Object reference not set to an instance of an object.
[31/10/2017 16:37:30]
[31/10/2017 16:37:30]
Listening on http://localhost:7071/
Hit CTRL-C to exit...

Http Functions:

    createQueueItem: http://localhost:7071/api/createQueueItem

info: Worker.Node.39ff4adc-f2c7-4d6a-af42-f1c60771bf35[0]
Worker 39ff4adc-f2c7-4d6a-af42-f1c60771bf35 connecting on 127.0.0.1:53991
```

Service bus bindings have not been migrated yet. The work is in progress:
https://github.com/Azure/azure-webjobs-sdk/issues/1329

Also its a bug that you got the null ref error, so i filed #1411

Was this page helpful?
0 / 5 - 0 ratings