Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.Azure.WebJobs.Host: Exception binding parameter 'db'. Fbeltrao.AzureFunctionExtensions: Object reference not set to an instance of an object. #8

Closed
ianpowell2017 opened this issue Dec 30, 2018 · 2 comments
Assignees

Comments

@ianpowell2017
Copy link

Hello,

I am struggling and hope you can help.

I have a WebFunction initiated by a QueueTrigger. When I add your nuget package to my Visual Studio 2017 project and add

[RedisDatabase(Connection = "%redis_connectionstring%")] IDatabase db,

and the connection setting in local.settings.json then when I run the webfunction then I get

[30/12/2018 15:52:24] System.Private.CoreLib: Exception while executing function: HttpRequestRedis. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'db'. Fbeltrao.AzureFunctionExtensions: Object reference not set to an instance of an object.

My Webfunction looks like this

        [FunctionName("HttpRequestRedis")]
        public static async Task Run(
            [QueueTrigger(CloudQueues.TempRequestLoggingForRedis, Connection = "StorageAccount")]string myQueueItem,
            [RedisDatabase(Connection = "%redis_connectionstring%")] IDatabase db,
            ILogger log
           )
          {
          }

If I remove the following from the method signature

[RedisDatabase(Connection = "%redis_connectionstring%")] IDatabase db,

Then it works as expected. Please advise how I may proceed.

Thanks

Ian

@fbeltrao
Copy link
Owner

Hi @ianpowell2017,

Thanks for reporting the problem. I have identified it and applied a fix (currently running).
Please let me know if it works now (I have included an example here: https://github.com/fbeltrao/AzureFunctionExtensions/blob/master/samples/RedisSample/QueueTriggerWithRedisFunctions.cs)

Cheers

@fbeltrao fbeltrao reopened this Dec 30, 2018
@fbeltrao fbeltrao self-assigned this Dec 30, 2018
@fbeltrao
Copy link
Owner

Version 1.0.22 has the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants