Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 57 forks source link

Adding Microsoft.Azure.WebJobs.Extensions.Storage 5.0.0 Nuget to API Function causes ServiceUnavailable #631

Open kylejuliandev opened 3 years ago

kylejuliandev commented 3 years ago

Describe the bug

Introducing the Microsoft.Azure.WebJobs.Extensions.Storage version 5.0.0, as found here, causes a ServiceUnavailable status code once deployed. This issues even when no functions output to a Storage Queue or Storage blog.

To Reproduce Steps to reproduce the behavior:

  1. Create .NET 6.0 Azure Function application a. Target AzureFunctionsVersion = v4 b. Add Nuget dependencies for the following

    • Microsoft.NET.Sdk.Functions = 4.0.1
    • Microsoft.Azure.WebJobs.Extensions.Storage.Queues = 5.0.0
  2. Create basic HTTP Trigger function (to help us check the function is deployed and operational) a. What the function does is irrelavant, we need one to deploy and test if the App API is functional

    [FunctionName("BlogArticleGetArticleFunc")]
    public static async Task<IActionResult> Run(
      [HttpTrigger(AuthorizationLevel.Function, "get", Route = "articles")] HttpRequest req,
      ILogger log)
    {
      log.LogInformation("C# HTTP trigger function processed a request.");
    
      return new OkObjectResult($"Hello, from the GetArticle function!");
    }
  3. Check in code

  4. Deploy to staging environment

  5. Send HTTP request to the HTTP Trigger GET /api/<trigger_route>

  6. See HTTP Response Status code and HTTP Response body

Expected behavior Function behaviours normally, and a 200 Status Code is returned

Screenshots

Image below details my simple Blazor WASM App calling out to the HTTP Trigger function, and logging the response status code and body.

Browser image showing the HTTP Response Status Code and Body with issue

Error message (from Application Insights) ` An error occurred while trying to encrypt the provided data. Refer to the inner exception for more information. For more information go to http://aka.ms/dataprotectionwarning Could not find any recognizable digits. `
Exception stacktrace (from Application Insights) ``` System.Security.Cryptography.CryptographicException: at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.DataProtection.DataProtectionCommonExtensions.Protect (Microsoft.AspNetCore.DataProtection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.Azure.WebJobs.Script.WebHost.DataProtectionKeyValueConverter.WriteValue (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\DataProtectionKeyValueConverter.cs:59) at Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.GenerateHostSecrets (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\SecretManager.cs:494) at Microsoft.Azure.WebJobs.Script.WebHost.SecretManager+d__18.MoveNext (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\Security\KeyManagement\SecretManager.cs:96) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.Azure.WebJobs.Script.WebHost.DefaultScriptWebHookProvider+d__7.MoveNext (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\WebHooks\DefaultScriptWebHookProvider.cs:74) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.Azure.WebJobs.Script.WebHost.DefaultScriptWebHookProvider.GetExtensionWebHookRoute (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\WebHooks\DefaultScriptWebHookProvider.cs:66) at Microsoft.Azure.WebJobs.Script.WebHost.DefaultScriptWebHookProvider.GetUrl (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\WebHooks\DefaultScriptWebHookProvider.cs:51) at Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Config.BlobsExtensionConfigProvider.InitilizeBlobBindings (Microsoft.Azure.WebJobs.Extensions.Storage.Blobs, Version=5.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8) at Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Config.BlobsExtensionConfigProvider.Initialize (Microsoft.Azure.WebJobs.Extensions.Storage.Blobs, Version=5.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8) at Microsoft.Azure.WebJobs.Host.DefaultExtensionRegistryFactory.Create (Microsoft.Azure.WebJobs.Host, Version=3.0.31.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\DefaultExtensionRegistryFactory.cs:38) at Microsoft.Azure.WebJobs.WebJobsServiceCollectionExtensions+<>c.b__2_0 (Microsoft.Azure.WebJobs.Host, Version=3.0.31.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsServiceCollectionExtensions.cs:57) at DryIoc.Microsoft.DependencyInjection.DryIocAdapter+<>c__DisplayClass3_0.b__0 (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\DryIocAdapter.cs:156) at DryIoc.Registrator+<>c__DisplayClass27_0.b__0 (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:4543) at System.Linq.Expressions.Interpreter.FuncCallInstruction`3.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.LightLambda.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Dynamic.Utils.DelegateHelpers.FuncThunk1 (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at DryIoc.Factory+<>c__DisplayClass26_0.b__2 (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6598) at DryIoc.Scope.TryGetOrAdd (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7842) at DryIoc.Scope.GetOrAdd (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7827) at DryIoc.Factory.ApplyReuse (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6597) at DryIoc.Factory.GetExpressionOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6557) at DryIoc.Factory.GetDelegateOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6627) at DryIoc.DelegateFactory.GetDelegateOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7733) at DryIoc.Container.DryIoc.IResolver.Resolve (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:290) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.LightLambda.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Dynamic.Utils.DelegateHelpers.FuncThunk1 (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at DryIoc.Factory+<>c__DisplayClass26_0.b__2 (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6598) at DryIoc.Scope.TryGetOrAdd (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7842) at DryIoc.Scope.GetOrAdd (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7827) at DryIoc.Factory.ApplyReuse (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6597) at DryIoc.Factory.GetExpressionOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6557) at DryIoc.Factory.GetDelegateOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6627) at DryIoc.Container.ResolveAndCacheDefaultFactoryDelegate (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:210) at DryIoc.Container.DryIoc.IResolver.Resolve (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:195) at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.JobHostServiceProvider.GetService (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\JobHostServiceProvider.cs:99) at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.JobHostServiceProvider.GetRequiredService (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\JobHostServiceProvider.cs:82) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService (Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService (Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.Azure.WebJobs.WebJobsServiceCollectionExtensions+<>c.b__2_4 (Microsoft.Azure.WebJobs.Host, Version=3.0.31.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsServiceCollectionExtensions.cs:95) at DryIoc.Microsoft.DependencyInjection.DryIocAdapter+<>c__DisplayClass3_0.b__0 (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\DryIocAdapter.cs:156) at DryIoc.Registrator+<>c__DisplayClass27_0.b__0 (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:4543) at System.Linq.Expressions.Interpreter.FuncCallInstruction`3.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.LightLambda.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Dynamic.Utils.DelegateHelpers.FuncThunk1 (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at DryIoc.Factory+<>c__DisplayClass26_0.b__2 (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6598) at DryIoc.Scope.TryGetOrAdd (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7842) at DryIoc.Scope.GetOrAdd (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7827) at DryIoc.Factory.ApplyReuse (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6597) at DryIoc.Factory.GetExpressionOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6557) at DryIoc.Factory.GetDelegateOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6627) at DryIoc.DelegateFactory.GetDelegateOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7733) at DryIoc.Container.DryIoc.IResolver.Resolve (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:290) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Expressions.Interpreter.LightLambda.Run (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Dynamic.Utils.DelegateHelpers.FuncThunk1 (System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at DryIoc.Factory+<>c__DisplayClass26_0.b__2 (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6598) at DryIoc.Scope.TryGetOrAdd (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7842) at DryIoc.Scope.GetOrAdd (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7827) at DryIoc.Factory.ApplyReuse (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6597) at DryIoc.Factory.GetExpressionOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6557) at DryIoc.ReflectionFactory.CreateExpressionOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7076) at DryIoc.Factory.GetExpressionOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6547) at DryIoc.ReflectionFactory.CreateExpressionOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:7076) at DryIoc.Factory.GetExpressionOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6547) at DryIoc.Factory.GetDelegateOrDefault (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:6627) at DryIoc.Container.ResolveAndCacheDefaultFactoryDelegate (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:210) at DryIoc.Container.DryIoc.IResolver.Resolve (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:195) at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.JobHostServiceProvider.GetService (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\JobHostServiceProvider.cs:99) at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.JobHostServiceProvider.GetService (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\DependencyInjection\JobHostServiceProvider.cs:77) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService (Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService+d__51.MoveNext (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:261) Inner exception System.FormatException handled at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect: at System.ParseNumbers.StringToInt (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Convert.ToByte (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.Azure.Web.DataProtection.Util+<>c__DisplayClass1_0.b__0 (Microsoft.Azure.WebSites.DataProtection, Version=0.1.6.0, Culture=neutral, PublicKeyToken=null) at System.Linq.Enumerable+SelectRangeIterator`1.ToArray (System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Linq.Enumerable.ToArray (System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at Microsoft.Azure.Web.DataProtection.Util.ConvertHexToByteArray (Microsoft.Azure.WebSites.DataProtection, Version=0.1.6.0, Culture=neutral, PublicKeyToken=null) at Microsoft.Azure.Web.DataProtection.AzureWebsitesXmlRepository.GetDefaultKey (Microsoft.Azure.WebSites.DataProtection, Version=0.1.6.0, Culture=neutral, PublicKeyToken=null) at Microsoft.Azure.Web.DataProtection.AzureWebsitesXmlRepository.GetAllElements (Microsoft.Azure.WebSites.DataProtection, Version=0.1.6.0, Culture=neutral, PublicKeyToken=null) at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider.GetCacheableKeyRing (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRing (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect (Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) ```

Additional notes

Removing the Microsoft.Azure.WebJobs.Extensions.Storage Nuget package and redeploying to the staging environment resolves the issue, and my function returns normally.

This may be a non-issue for most as a workaround is possible, but I was wanting to raise it to highlight an issue

Workaround

Redeploying with a specific Microsoft.Azure.WebJobs.Extensions.Storage.Queues or Microsoft.Azure.WebJobs.Extensions.Storage.Blobs Nuget works as expected, and I can utilise relevant functions (Queue or Blob).

anthonychu commented 2 years ago

The function app included with Static Web Apps doesn’t have AzureWebJobsStorage defined (nor is it currently supported). I wonder if the error was due to this.

TheMightyBorkon commented 2 years ago

I'm having the same issue, although my frontend is in Angular.

Either Azure Storage should be supported from the API and this is a bug, or it isn't supported at all.

Looking through the documentation there is no mention that you cannot use Azure Storage from your API code. If this is a restriction of the free tier, then it should be listed as such in the documentation.

I'm hoping that this is in fact a bug, and will be fixed in a future release. It makes no sense to me that Microsoft would impose this restriction on the free tier: they would still be charging for ingress and egress from the storage account if it were supported.

As things stand, the only workaround is to switch to the standard plan (paid for) and "bring your own function", at which point you lose the advantage of having both in the same repository, and have to move to two separate deployments.

I don't know much about Amazon Web Services, but I presume they have a similar product to Azure Storage, where you could store blobs. So in theory you could use the free tier of Azure Static Web Apps and talk to AWS from the API. At which point, Microsoft is no longer getting the money you would have spent on Azure Storage. This seems like a missed opportunity for MS to me.

TheMightyBorkon commented 2 years ago

Redeploying with a specific Microsoft.Azure.WebJobs.Extensions.Storage.Queues or Microsoft.Azure.WebJobs.Extensions.Storage.Blobs Nuget works as expected, and I can utilise relevant functions (Queue or Blob).

@kylejuliandev Your workaround does not work for me, unfortunately. Adding a reference to Microsoft.Azure.WebJobs.Extensions.Storage.Blobs give me the 503 error on deployment.

anuraj commented 2 years ago

I was also facing the issue. I removed Microsoft.Azure.WebJobs.Extensions.Storage package reference and it started working properly.

cwoz117 commented 2 years ago

I am seeing this as well with React (both with GitHub actions and with Azure DevOps Tasks)

It looks like I can define a separate connection in the binding, but it fails to start with the missing app setting AzureWebJobsStorage We cannot create them because of the AzureWeb prefix block (by design)

I read documentation saying we don't even need to provide the prefix when we define the connection but I don't know how we leverage that given the prefix ban.

Even the error message asks me to add a secret storage type requiring the banned prefix:

Secret initialization from Blob storage failed due to missing both an Azure Storage connection string and a SAS connection uri. For Blob Storage, please provide at least one of these. If you intend to use files for secrets, add an App Setting key 'AzureWebJobsSecretStorageType' with value 'Files'. 
jonnekleijer commented 1 year ago

@anthonychu , @TheMightyBorkon I ran into this issue for our SWA as well (react spa, managed az functions, github actions).

For me the references to both Microsoft.Azure.WebJobs.Extensions.Storage.Blobs or Microsoft.Azure.WebJobs.Extensions.Storage were causing the 503 error on deployment.

Workaround Use Azure.Storage.Blobs instead.