skip to Main Content

I am trying to run the Human interaction in Durable Functions and i got the sample from the microsoft doc page. You can get the code @ https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-phone-verification?tabs=csharp

I got the following error.

Method not found: ‘Void
Twilio.Clients.TwilioRestClient..ctor(System.String, System.String,
System.String, System.String, Twilio.Http.HttpClient)’

I installed following nuget packages

  • Microsoft.Azure.WebJobs.Extensions.Twilio – 3.0.2
  • Twilio – 5.75.1

Currently using .Net 6.0

2

Answers


  1. Chosen as BEST ANSWER

    I removed the Twilio nuget dependency and everything was OK, there was a conflict between the Microsoft.Azure.WebJobs.Extensions.Twilio and Twilio


  2. The Microsoft.Azure.WebJobs.Extensions.Twilio hasn’t been updated since 1/26/2021 so it depends on an old version of the Twilio package, version 5.6.3.

    In version 5.6.3 of the Twilio package, the constructor looked like this:

    public TwilioRestClient(
        string username,
        string password,
        string accountSid = null,
        string region = null,
        HttpClient httpClient = null
    )
    

    (source code on GitHub)

    But in the version that you upgraded the Twilio package to, the constructor is like this:

    public TwilioRestClient(
        string username,
        string password,
        string accountSid = null,
        string region = null,
        HttpClient httpClient = null,
        string edge = null
    )
    

    (source code on GitHub)

    So the Microsoft.Azure.WebJobs.Extensions.Twilio can’t find the constructor signature it is looking for. It may look like it’s backwards compatible, but it’s a breaking change because Microsoft.Azure.WebJobs.Extensions.Twilio has to be recompiled with the new version to start using the updated constructor.

    You have a couple of options:

    • You can not use the Microsoft.Azure.WebJobs.Extensions.Twilio package and straight up use the Twilio package and use the Twilio SDK to send the messages. The Azure package doesn’t do that much for you so you should be able to swap it out with relative ease. I would go with this option for now.
    • You can remove the Twilio dependency so it falls back on the version that Microsoft.Azure.WebJobs.Extensions.Twilio uses, although then you’ll be with an outdated version of the Twilio package which is also not good as you may miss out on bug and security fixes.
    • You can grab the source code for Microsoft.Azure.WebJobs.Extensions.Twilio, update the Twilio dependency and use your own version of the code.

    There’s two ways for Twilio or Azure to fix this, either Twilio provides an overload without the edge parameter, or the Azure updates the Twilio package to something more recent.
    I will open issues in both projects so we can get both updates started at the same time and hopefully this won’t be an issue anymore in the near future.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search