Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api Undeploy issue #409

Closed
zeinabawd opened this issue Feb 28, 2024 · 4 comments · Fixed by #512
Closed

Api Undeploy issue #409

zeinabawd opened this issue Feb 28, 2024 · 4 comments · Fixed by #512

Comments

@zeinabawd
Copy link

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

@kurtkanaskie
Copy link
Collaborator

kurtkanaskie commented Feb 28, 2024

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"
      }
    ]
  }
}

@DinoChiesa
Copy link
Contributor

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?

@zeinabawd
Copy link
Author

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

@joaoorosario
Copy link

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

@srinandan srinandan linked a pull request Jul 18, 2024 that will close this issue
srinandan added a commit that referenced this issue Jul 18, 2024
srinandan added a commit that referenced this issue Jul 18, 2024
* bug: sets safeundeploy default to false #409

* bug: update the description #409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants