serverless-google-cloudfunctions icon indicating copy to clipboard operation
serverless-google-cloudfunctions copied to clipboard

Function does not exist error

Open kospol opened this issue 8 years ago • 4 comments

Serverless deploy creates this error. It looks like something is wrong on the google side. This behavior is happening after I remove a function that used to be there, but the error names my current function.

For example I had two functions, FUNCTIONNAME1, FUNCTIONNAME2. Both of them are deployed. I remove FUNCTIONNAME1 and deploy again. I get this error:

Serverless: Checking deployment update progress... 
  Error --------------------------------------------------
  Deployment failed: RESOURCE_ERROR
     {"ResourceType":"cloudfunctions.v1beta2.function","ResourceErrorCode":"404","ResourceErrorMessage":{"code":404,"message":"Function FUNCTIONNAME2 in region us-central1 in project PROJECTNAME does not exist","status":"NOT_FOUND","details":[],"statusMessage":"Not Found","requestPath":"https://cloudfunctions.googleapis.com/v1beta2/projects/PROJECTNAME/locations/us-central1/functions/FUNCTIONNAME2","httpMethod":"GET"}}

kospol avatar Nov 08 '17 19:11 kospol

Hey, i got the same issue, anyone can advise ?

thucnc avatar Nov 21 '18 03:11 thucnc

This happened to me in my staging environment, so I was able to delete some resources to clear the error.

I removed my Storage Buckets and also my Deployment Manager > Deployments and then was able to re-deploy without any issues.

sketchthat avatar May 06 '19 06:05 sketchthat

Just ran into this as well. I think it has to do with weird Google caching. Don't delete the storage bucket as serverless will still expect it to exists and throw a Not Found error, just delete everything inside the bucket, run serverless remove and then serverless deploy. That should kind of reset things for you.

dylanbathurst avatar Jul 09 '19 23:07 dylanbathurst

Using serverless-google-cloudfunctions v3.1.1 i encountered this problem over and over again. In node_modules/serverless-google-cloudfunctions/shared/monitorDeployment.js, from line 34 and onwards, I changed from:

const deployment = response.deployments.find((dep) => dep.name === deploymentName);

// if actions is "remove" and deployment disappeared then set to "DONE"
if (!deployment && action === 'remove') {
  deploymentStatus = 'DONE';
  callback();
}

throwErrorIfDeploymentFails(deployment);

to:

const deployment = response.deployments.find((dep) => dep.name === deploymentName);

if (!deployment) {
// if actions is "remove" and deployment disappeared then set to "DONE"
  if (action === 'remove') {
    deploymentStatus = 'DONE';
    callback();
  }
  else {
    throwErrorIfDeploymentFails(deployment);
  }
}

After that everything was OK. Non-existent deployment not only when action === 'remove' apparently. I wonder if this is a bug, or a symptom of some other problem.

per-garden avatar Sep 04 '20 16:09 per-garden