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://docs.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
CodePudding user response:
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
)
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
)
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 theTwilio
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 thatMicrosoft.Azure.WebJobs.Extensions.Twilio
uses, although then you'll be with an outdated version of theTwilio
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 theTwilio
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.
CodePudding user response:
I removed the Twilio dependency and everything was OK, there was a conflict between the Microsoft.Azure.WebJobs.Extensions.Twilio and Twilio