Reputation: 2435
I am having an issue where my EventHubTriggerAttribute is no longer using my local.settings.json file to populate the event hub name in the attribute. This is the error I am getting:
In the above error it is looking for ddhubnamespace.servicebus.windows.net/eventhubname
which should really be ddhubnamespace.servicebus.windows.net/ddhub
This is the event hub name in the TriggerAttribute here:
public static void Run([EventHubTrigger("eventHubName", Connection = "eventHubConnection")]string data, TraceWriter log)
This was using the local.settings.json file I had to grab the eventHubName from here:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_EXTENSION_VERSION": "~1",
"eventHubConnection": "Endpoint=sb://ddhubnamespace.servicebus.windows.net/;...",
"eventHubName": "ddhub",
If inside the attribute I switch out "eventHubName" for the actual event hub name in the local.settings.json ("ddhub"). The function will run successfully. Also having the Connection property in the attribute set to the json name will grab the value from the json. Any idea as to why my eventhubname is no longer pulling from the json, but instead is taking it as a literal string?
Upvotes: 2
Views: 1309
Reputation: 35124
To take the value from config file, you should mark it with %
in attribute parameter:
[EventHubTrigger("%eventHubName%", Connection = "eventHubConnection")]
Upvotes: 7