question

UdayKumar-7241 avatar image
0 Votes"
UdayKumar-7241 asked mario-galindo answered

azure function not able to recieve message from servicebus

I have created Azure function in MS Visual Studio which listens for events from servicebus topic.
When I published to Azure Function app. It is not even running.

It is showing the below error in azure portal


"Azure Functions runtime is unreachable"

Under Activity log I see below error:

Encountered an error (InternalServerError) from host runtime.

I am seeing below error under notificactions:

Functions runtime error
Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string 'Endpoint=sb://hgservicebusns.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;[Hidden Credential]' is missing or empty.

Can someone help me resolving this issue. It is very urgent from the delivery point of time.

azure-functionsazure-service-bus
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Additional information :

Getting below error while debugging azure function locally using microsoft visual studio :

Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string 'Endpoint=sb://hgservicebusns.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;[Hidden Credential]' is missing or empty.

However, I could see in my code the complete endpoint URL is given. With the same endpoint, I wrote a javascript code to receive a message from the same topic. It is working fine without any issues locally.

II added the connection string into local.settings.json file as below :
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=iotwebapp;AccountKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==;BlobEndpoint=https://XXXXXXXXX.blob.core.windows.net/;TableEndpoint=https://XXXXXXXXXX.table.core.windows.net/;QueueEndpoint=https://iotwebapp.queue.core.windows.net/;FileEndpoint=https://iotwebapp.file.core.windows.net/",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"AzureWebJobsServiceBus": "Endpoint=sb://hgservic........",
"connection": "Endpoint=sb://hgservic........",
}
}

0 Votes 0 ·
MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered MayankBargali-MSFT edited

@UdayKumar-7241 As per your local.settings.json you have define service bus connection string using connection parameter.
Please make sure that you have define the same parameter in your Service Bus trigger Connection

If there is mismatch then I do observe the same error as you have shared. The same is covered example section of the document.

In the document example it is mentioned as ServiceBusConnection so my local.settings.json should also have ServiceBusConnection paramter define.
public static void Run([ServiceBusTrigger("myqueue", Connection = "ServiceBusConnection")]

In your case as you have define it as connection so your trigger should be define as below:
public static void Run([ServiceBusTrigger("myqueue", Connection = "connection")]

In case if you have also define AzureWebJobsServiceBus then your Connection should be empty as mentioned in configuration section. It looks like you have define both.

Feel free to get back to me if you are still facing the isue.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

mario-galindo avatar image
0 Votes"
mario-galindo answered

You need to define your connection string on azure portal in the FunctionApp -> Settings/Configuration section.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.