Why Azure function failing to start when bound with EventGrid attribute bound with IAsyncCollector

Muhammad Usman Khalil 1 Reputation point
2020-06-03T08:25:57.667+00:00

Hello,

I am facing strange initialization issue regarding Azure Function.

Following is the code for HttpTriggered Azure Function.

public static async Task<IActionResult> OnboardOrganization(  
        [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "onboarding/organization/")]  
        HttpRequest httpRequest,  
        [EventGrid(TopicEndpointUri = "MyEventGridTopicUriSetting", TopicKeySetting = "MyEventGridTopicKeySetting")]  
        IAsyncCollector<EventGridEvent> outputEvents, ILogger log)  
    {  
  
        var credentialSpecifier = CredentialSpecifier.NewBuilder()              
            .AllowRole(Role.Admin).AllowRole(Role.OrgAdmin).Build();  
  
        var requestBody = RequestProcessor.GetRequestBodyAsString(httpRequest);  
       ......................................................................  
     }  

But If I remove reference of 'Microsoft.Azure.WebJobs.Extensions.EventGrid', error goes away.

Error at console :

8948-functionhosterror.png

Can any body let me know how to getrid of this? Thanks

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,425 questions
{count} votes