apigeecli icon indicating copy to clipboard operation
apigeecli copied to clipboard

Api Undeploy issue

Open zeinabawd opened this issue 1 year ago • 3 comments

Hello I'm using apigeecli undeploy command but only yesterday it started to fail saying 404 not found however the deployment itself already there

So If I run listdeploy command it sees the deployed revision

apigeecli -t $TOKEN apis listdeploy --org --env sandbox --name test-destroy --rev 1 | jq { "environment": "sandbox", "apiProxy": "test-destroy", "revision": "1", "deployStartTime": "1709117820809", "state": "READY", "instances": [ { "instance": "apigeex-europe-west3", "deployedRevisions": [ { "revision": "1", "percentage": 100 } ], "deployedRoutes": [ { "basepath": "/test-destroy", "envgroup": "vftst-sandbox", "environment": "sandbox", "percentage": 100 } ] } ], "proxyDeploymentType": "STANDARD" }

But when I run undeploy command it gives me this error

apigeecli -t $TOKEN apis undeploy --org --env sandbox --name test-destroy --rev 1 { "error": { "code": 404, "message": "generic::not_found: organizations//apis/test-destroy/revisions/1 is not deployed", "status": "NOT_FOUND", "details": [ { "@type": "type.googleapis.com/google.rpc.RequestInfo", "requestId": "14281491751338632959" } ] } }

Error: Not found - the server cannot find the requested resource Usage: apigeecli apis undeploy [flags]

Flags: -e, --env string Apigee environment name -h, --help help for undeploy -n, --name string API proxy name -v, --rev int API Proxy revision (default -1) --safeundeploy When set to true, generateUndeployChangeReport will be executed and undeployment will proceed if there are no conflicts; default is true (default true)

Global Flags: -a, --account string Path Service Account private key in JSON --default-token Use Google default application credentials access token --disable-check Disable check for newer versions --metadata-token Metadata OAuth2 access token --no-output Disable printing all statements to stdout -o, --org string Apigee organization name --print-output Control printing of info log statements (default true) -t, --token string Google OAuth Token

zeinabawd avatar Feb 28 '24 11:02 zeinabawd

Hi @zeinabawd I've recently noticed this behavior when I was testing creating and deploying the maximum # of proxies (4250) but I thought it may have been related to the number of proxies. I've verified it is the same in the latest v1.125.2 and 2.0.0-beta.4

It works is you use --safeundeploy=false

There's also a mistake in the parameter doc --safeundeploy When set to true, generateDeployChangeReport will be executed and deployment will proceed if there are no conflicts; default is true (default true)

Should say undeployment

Upon further investigation, the API that is being called to check the change report is returning the error. This is the case even when calling the API directly

curlx -X POST https://apigee.googleapis.com/v1/organizations/$ORG/environments/test/apis/notarget-1/revisions/2/deployments:generateUndeployChangeReport
{
  "error": {
    "code": 404,
    "message": "generic::not_found: organizations/********/apis/notarget-1/revisions/2 is not deployed",
    "status": "NOT_FOUND",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.RequestInfo",
        "requestId": "9322455582045105468"
      }
    ]
  }
}

kurtkanaskie avatar Feb 28 '24 13:02 kurtkanaskie

Not sure... are you passing the organization name or not? your initial post showed

apigeecli -t $TOKEN apis listdeploy --org --env sandbox --name test-destroy --rev 1

Eg, no argument to --org.

Same for your undeploy command

apigeecli -t $TOKEN apis undeploy --org --env sandbox --name test-destroy --rev 1

The error message for that command shows

"message": "generic::not_found: organizations//apis/test-destroy/revisions/1 is not deployed",

...which indicates you haven't passed an organization. Can you check and confirm?

DinoChiesa avatar Mar 01 '24 20:03 DinoChiesa

I’ve passed the organization correctly I only removed it from the post just not to reveal company information

if you check the output of the listdeploy command you’ll find it’s already returning that the deployment exists with revision 1 but the undeploy command for a weird reason says the deployment doesn’t exist

A side note that command I have in pipeline and was working fine till the day before writing the post we noticed all pipelines are failing because of this command the tried the same command locally and gave the same error

I’ve added --safeundeploy=false option as a temp solution as suggested in the above comment and it was able to undeploy and pipelines passed But I’m still wondering what has changed and made it out of the sudden not working

zeinabawd avatar Mar 01 '24 21:03 zeinabawd

Just came across the same issue, will use the workaround --safeundeploy=false for now, thanks @kurtkanaskie

joaoorosario avatar Jul 18 '24 12:07 joaoorosario