serverless / serverless-google-cloudfunctions

Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
https://www.serverless.com
MIT License
271 stars 126 forks source link

Function does not exist error #90

Open kospol opened 6 years ago

kospol commented 6 years ago

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"}}
thucnc commented 5 years ago

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

sketchthat commented 5 years ago

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.

dylanbathurst commented 5 years ago

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.

per-garden commented 4 years ago

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.