twilio-aspnet icon indicating copy to clipboard operation
twilio-aspnet copied to clipboard

Latest version (8.0) Not compatible with Azure Function Apps v4

Open armyofmarkness opened this issue 1 year ago • 6 comments

Thanks to how the function app runtime is setup, and the use of .net 7 logging packages in twilio-asp.net v8.0, it is no longer compatible with the azure function v4 runtime.

repro steps:

  1. create a new function app v4 in visual studio
  2. install twilio and twilio.aspnet.core nuget packages
  3. run function app, note runtime error linking logging extensions v7.

Microsoft is aware of the issue and did the same thing with their entity framework (oops!). more info here: https://github.com/Azure/Azure-Functions/issues/2319

version 7 of this package is flagged with critical errors. any chance you could package up another version of 8.0 that uses the .net 6 logging framework? (2.1/2.2)?

Thanks!

armyofmarkness avatar Apr 25 '23 15:04 armyofmarkness

We don't have an explicit dependency on any logging package. Are you able to pin down the logging package version in your project yourself?

Swimburger avatar Apr 25 '23 16:04 Swimburger

This is a chained dependency due to twilio.apsnet.core 8.0 requiring Microsoft.Extensions.Http 7.0 which in turn depends upon Microsoft.Extensions.Logging 7.0.

armyofmarkness avatar Apr 25 '23 16:04 armyofmarkness

Publishing and maintaining multiple versions because other hosting services aren't compatible won't be manageable for us. Microsoft's recommends using isolated hosting, because these kinds of issue happen all the time.

The reason previous versions were marked as deprecated was because of this security issue that was raised internally and fixed in v8. You could stay on the previous version and make sure AllowLocal is set to false if you're using the request validation feature. Of course, you'll be stuck on that version missing out on future improvements and security fixes.

Swimburger avatar Apr 25 '23 16:04 Swimburger

Yea, that's fair. The isolated hosting breaks the other side (Twilio SMS binding), but there are ways around that, so that may be the best approach. I'll try just hitting the base Twilio sdk directly without the wrapper as well.

Thanks for the reply, feel free to close this out.

armyofmarkness avatar Apr 25 '23 17:04 armyofmarkness

I see, is there an issue you can point me to for the problems with Twilio and isolated hosting? I'd like to help if I can.

Swimburger avatar Apr 25 '23 21:04 Swimburger

Oh, no. It's just that the built-in bindings are part of the hosted environment, so if we use the isolated worker process to get around this package mismatch, we also lose those bindings.

eg: https://www.twilio.com/blog/send-sms-with-csharp-dotnet-and-azure-functions-using-the-twilio-output-binding

armyofmarkness avatar Apr 26 '23 00:04 armyofmarkness