Open kylejuliandev opened 3 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.
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.
Redeploying with a specific
Microsoft.Azure.WebJobs.Extensions.Storage.Queues
orMicrosoft.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.
I was also facing the issue. I removed Microsoft.Azure.WebJobs.Extensions.Storage
package reference and it started working properly.
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'.
@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.
Describe the bug
Introducing the
Microsoft.Azure.WebJobs.Extensions.Storage
version5.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:
Create
.NET 6.0
Azure Function application a. Target AzureFunctionsVersion =v4
b. Add Nuget dependencies for the following4.0.1
5.0.0
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
Check in code
Deploy to staging environment
Send HTTP request to the HTTP Trigger
GET /api/<trigger_route>
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.
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+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
orMicrosoft.Azure.WebJobs.Extensions.Storage.Blobs
Nuget works as expected, and I can utilise relevant functions (Queue or Blob).