Google Cloud Functions deploy - NoSuchKey failure (us.artifacts. sha256 image) after creating delete rules - node.js

After realizing I was being charged for storage as a result of Google Cloud Functions deployments, I read this thread and created a 3-day deletion rule for my us.artifacts.{myproject}.appspot.com folder. Now I am trying to deploy an existing function and am getting the below. How can I resolve this? Should I delete the whole image folder?
[0mfailed to export: failed to write image to the following tags: [us.gcr.io/myproject/gcf/us-central1/3a36a5e8-92b5-426e-b230-ba19ffc92ba8:MYFUNCTION_version-64:
GET https://storage.googleapis.com/us.artifacts.myproject.appspot.com/containers/images/sha256:{some long string}?access_token=REDACTED:
unsupported status code 404; body: <?xml version='1.0' encoding='UTF-8'?>
<Error><Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message><Details>No such object: us.artifacts.myproject.appspot.com/containers/images/sha256:{some long string}</Details></Error>]
Edit 1: My deploy command (which has been previously working for months):
gcloud functions deploy MYFUNCTIONNAME --source https://source.developers.google.com/projects/MYPROJECT/repos/MYREPO --trigger-http --runtime nodejs10 --allow-unauthenticated
Edit 2: I have an separate cloud function that points to the exact same source repository (but is located in europe-west3) and it updated fine without issue. However, this function was last updated in December while the failing function was last updated 2 days ago.
Edit 3: Well, in the end I just duplicated the Cloud Function and I am able to update and deploy the new one without issue. I retained the 3 day deletion for the container and this and other functions are updating without issue as well. No idea why this original function kept getting this error.

As is recommended in the answer of the another question, it is better delete the whole bucket, this action will destroy all elements and configurations related to this bucket, avoiding issues between Functions, Storage & Container Registry, if you delete only the containers some configurations will be remained affecting further deploys.

Related

sam local invoke timeout on newly created project (created via sam init)

I create a new project via sam init and I select the options:
1 - AWS Quick Start Templates
1 - nodejs14.x
8 - Quick Start: Web Backend
Then from inside the project root, I run sam local invoke -e ./events/event-get-all-items.json getAllItemsFunction, which returns:
Invoking src/handlers/get-all-items.getAllItemsHandler (nodejs14.x)
Skip pulling image and use local one: public.ecr.aws/sam/emulation-nodejs14.x:rapid-1.32.0.
Mounting /home/rob/code/sam-app-2/.aws-sam/build/getAllItemsFunction as /var/task:ro,delegated inside runtime container
Function 'getAllItemsFunction' timed out after 100 seconds
No response from invoke container for getAllItemsFunction
Any idea what could be going on or how to debug this? Thanks.
Any chance the image/lambda make a call to a database someplace? and does the container running the lambda have the right connection string and/or access? To me sounds like your function is getting called and then function is trying to reach something that it can't reach.
As far as debugging - lots of console.log() statements to narrow down how far your code is getting before it runs into trouble.

Unable to deploy/update google cloud function

I have a Firebase project with 29 functions 2 with python and 27 with nodejs.
Modified 2 of them and now I can't deploy properly. I get an error log that send me to the logviewer and one of the errors is:
ERROR: build step 3
"us.gcr.io/fn-img/buildpacks/nodejs10/builder:nodejs10_20201201_20_RC00"
failed: step exited with non-zero status: 46
The functions keep on working, but I can't update/deploy properly. When I try to deploy them individually I get that error for both functions, but when I try to deploy ALL the functions I only get the error with those 2 functions the rest of the functions, that don't have any modification have no problem redeploying.
I checked the source code in the Cloud console and they have a warning icon saying that:
Function is active, but last deployment failed
The source code in the Cloud console is the same as the one I'm trying to deploy but the functions has the same functionality that before when I made the changes, the functions still works but can't update.
These are javascript functions that I deployed using the Firebase Node Sdk.
Any help?
EDIT I:
I reverted the changes on one of the functions that's been there for over 2 years and still have the same issue, can't update/deploy, that function triggers on storage.onFinalize().
The other function on firestore.onCreate()
EDIT II:
The newest function that I created is not in use, is part of a new feature in my android application, so I duplicated it, gave it different name and deployed without issues. In that case I could delete the original function without any issue as is not being used. But I can't do the same for the other function, the other function is constantly in use.

Azure: what could be the cause of the error "Unable to edit or replace deployment"?

When I recreate my VM I got the following error:
Problem occurred during request to Azure services. Cloud provider details: Unable to edit or replace deployment 'VM-Name': previous deployment from '8/20/2019 6:20:33 AM' is still active (expiration time is '8/27/2019 5:17:41 AM'). Please see https://aka.ms/arm-deploy for usage details.
Help me please to understand.
What could be the cause of the error ?
UPDATED:
This deployment has not been started previously.
Prior to this, errors were received during creation:
Azure is not available now. Please Try again later
There were several such errors one at a time and then I got that error related to:
Unable to edit or replace deployment
My assumptions about this.
Tell me, am I right or not ?
I launched the image, then after some time I recreated it.
Creation began, but at that moment the connection with Azure was lost.
Then, when the connection was restored, we tried to make a deployment that was not removed in the previous attempt (because there was no connection with Azure).
As a result, we got such an error.
Does this theory make sense?
exactly what it says, there is another deployment with the same name going on at this time, either change the name of the deployment you are trying to queue or wait for the other deployment to finish\fail
This can also occur if you use Bicep templates for your ARM deployement and multiple modules or resources in the template have the same name:
module fooModule '../modules/foo.bicep' = {
name: 'foo'
}
module barModule '../modules/bar.bicep' = {
name: 'foo'
}
I got the same error initially pipeline was working but when retriggered pipeline took more time so i canceled the deployment and made a fresh rerun it encounters. i think i need wait until that deployment filed.

Azure Functions: We are not able to retrieve the runtime master key

Azure Functions bug. I get the error in the portal
Error:
We are not able to retrieve the runtime master key. Please try again later.
Session Id: d13fceebd4ea4cb1b7fb3d3829dd1406
Timestamp: 2017-08-24T20:04:23.555Z
I've tried all of the suggestions here:
https://blogs.msdn.microsoft.com/jpsanders/2017/05/09/function-app-error-we-are-not-able-to-retrieve-the-runtime-master-key/
I'm using the runtime version 1.0.10917 but I've tried ~1 and get the same result.
This seems to occur when I delete the function from the portal and then recreate it. It consistently happens after that for every function we have. The first time the function is created, it seems to work.
This is the exception you're hitting
System.Security.Cryptography.CryptographicException : The payload was invalid.
at Microsoft.AspNetCore.DataProtection.Cng.CbcAuthenticatedEncryptor.DecryptImpl(Byte* pbCiphertext,UInt32 cbCiphertext,Byte* pbAdditionalAuthenticatedData,UInt32 cbAdditionalAuthenticatedData)
at Microsoft.AspNetCore.DataProtection.Cng.Internal.CngAuthenticatedEncryptorBase.Decrypt(ArraySegment`1 ciphertext,ArraySegment`1 additionalAuthenticatedData)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData,Boolean allowOperationsOnRevokedKeys,UnprotectStatus& status)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData,Boolean ignoreRevocationErrors,Boolean& requiresMigration,Boolean& wasRevoked)
at Microsoft.Azure.WebJobs.Script.WebHost.DataProtectionKeyValueConverter.Unprotect(Key key) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Security\DataProtectionKeyValueConverter.cs : 43
at Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.ReadHostSecrets(HostSecrets hostSecrets) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Security\SecretManager.cs : 383
at async Microsoft.Azure.WebJobs.Script.WebHost.SecretManager.GetHostSecretsAsync() at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Security\SecretManager.cs : 83
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.WebHost.WebJobsSdkExtensionHookProvider.GetOrCreateExtensionKey(String extensionName) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebHooks\WebJobsSdkExtensionHookProvider.cs : 71
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsSdkExtensionHookProvider.GetExtensionWebHookRoute(String extensionName) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebHooks\WebJobsSdkExtensionHookProvider.cs : 64
at Microsoft.Azure.WebJobs.Extensions.EventGrid.EventGridExtensionConfig.Initialize(ExtensionConfigContext context)
at Microsoft.Azure.WebJobs.Host.Executors.JobHostConfigurationExtensions.InvokeExtensionConfigProviders(ExtensionConfigContext context)
at Microsoft.Azure.WebJobs.Host.Executors.JobHostConfigurationExtensions.CreateStaticServices(JobHostConfiguration config)
at Microsoft.Azure.WebJobs.JobHost.PopulateStaticServices()
at Microsoft.Azure.WebJobs.Script.Utility.CreateMetadataProvider(JobHost host) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Utility.cs : 362
at Microsoft.Azure.WebJobs.Script.ScriptHost.LoadCustomExtensions() at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHost.cs : 670
at Microsoft.Azure.WebJobs.Script.ScriptHost.Initialize() at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHost.cs : 510
at Microsoft.Azure.WebJobs.Script.ScriptHost.Create(IScriptHostEnvironment environment,IScriptEventManager eventManager,ScriptHostConfiguration scriptConfig,ScriptSettingsManager settingsManager) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHost.cs : 937
It's very hard for users to discover these errors for their app because the runtime doesn't log them anywhere the UX can query.
This issue is tracking the exception: https://github.com/Azure/azure-webjobs-sdk-script/issues/1832
We are still not entirely sure why this is happening. Did you republish your keys from another application by any chance? (edit: or delete and recreate the app with the same name) these keys are encrypted by a function app specific key, and won't work outside that context.
fix: copied from Fabio Cavalcante
can you delete (or rename) the host.json file in
d:\home\data\Functions\secrets\ and retry? This will force the runtime
to re-create those secrets for that environment. Keep in mind that
this would also change your master and default keys.
Switching the Azure Function storage account to a new storage account can trigger a similar issue.
Error: We are not able to get the key swaggerdocumentationkey.
Please check the runtime logs for any errors or try again later.
This is likely related to the storage account being uninitialized with the new site. I can't confirm the behavior, but it seems that when switching storage accounts the new account doesn't initialize a new site and will cause similar issues.
i deleted the azure functions and renamed it. After that it started working fine. Looks like even when you delete the azure functions, traces are there in azure logs and screwing up something.
Also make sure you keep separate azure blob storage for every functions, if you use it in more than one azure function, then it is giving some weird errors. I think they are using it for logging and authentication purposes.

Azure function upload failing with "A task was canceled"

I am getting the following error when using the following command to upload my function app:
func azure functionapp publish FuncAppName
I ran this from both the parent directory of the function app and the function app directory itself, and got the same error. It looks like some task in the upload times out after a minute or so:
Publish C:\Users\username\Documents\visual studio 2017\Projects\AzureFuncApp contents to an Azure Function App. Locally deleted files are not removed from destination.
Getting site publishing info...
Creating archive for current directory...
Uploading archive...
A task was canceled.
Any idea how to solve this/get more debugging info?
The function in question already exists on Portal and is running. I was previously able to upload it successfully.
Please refer to this GitHub issue:
https://github.com/Azure/azure-functions-cli/issues/147
A change has been made to address this issue and will be included in the next CLI release.

Resources