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

Change API state to unpublised with apim-cli causes update error #369

Open
fbessai opened this issue Mar 20, 2023 · 2 comments
Open

Change API state to unpublised with apim-cli causes update error #369

fbessai opened this issue Mar 20, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@fbessai
Copy link

fbessai commented Mar 20, 2023

APIM-CLI version

1.13.5

API-Management version

7.7.0.20220228

Bug description

For an API that is in a "published" state with at least one subscription, if we update the state to "unpublished" via apim-cli we get an error "Unknown API"

Steps to reproduce

  • In apim, have an API in a "published" state with at least one subscription
  • With apim-cli, update the state of this api to "unpublished"

Relevant log output

6545   INFO      APIImportManager| Re-Creating API as the ForceUpdate flag is set

6546   INFO   RecreateToUpdateAPI| Create new API to update existing: 'FB_TEST_1888' (ID: 4ab20d2d-b189-40c3-9706-ccc33d031401)

6547   DEBUG APIManagerAPIAdapter| Import backend API: FB_TEST_1888 based on Swagger 2.0 specification.

7428   INFO          CreateNewAPI| Create unpublished API: 'FB_TEST_1888' 1.0 based on Swagger 2.0 specification.

7429   DEBUG APIManagerAPIAdapter| Create Front-End API: 'FB_TEST_1888' (API-Proxy)

7935   DEBUG APIManagerAPIAdapter| Updating API-Proxy: 'FB_TEST_1888 1.0 (cb0c158c-05d2-4c39-b082-27210808d147)'

8222   DEBUG     APIStatusManager| Desired and actual status equal. No need to update status!

8222   INFO  APIManagerAPIAdapter| API to upgrade access has state unpublished.

8222   DEBUG APIManagerAPIAdapter| Found: 1 subscribed applications for this API. Taking over potentially configured quota configuration.

8225   INFO      ManageClientApps| Creating API-Access for the following apps: '[[MYAPP (4cb69988-5d02-4866-a20e-5326b523259c)]]'

8225   INFO      ManageClientApps| Creating API-Access for application 'MYAPP'

8225   DEBUG agerAPIAccessAdapter| Load API-Access with type: applications from API-Manager with ID: 4cb69988-5d02-4866-a20e-5326b523259c

8652   WARN  agerAPIAccessAdapter| Got unexpected error: 'Unknown API' while creating API-Access ... Try again in 1000 milliseconds. (you may set -retryDelay <milliseconds>)

9720   ERROR agerAPIAccessAdapter| Error creating/updating API Access: APIAccess [apiName=null, apiVersion=null, id=null, apiId=cb0c158c-05d2-4c39-b082-27210808d147]. Response-Code: 404. Got response: '{"errors":[{"code":404,"message":"Unknown API"}]}'

9723   INFO      RollbackAPIProxy| Rollback FE-API: 'FB_TEST_1888' (ID: 'cb0c158c-05d2-4c39-b082-27210808d147' / State: 'unpublished')

9724   DEBUG APIManagerAPIAdapter| Sending request to find existing APIs: https://xxxxxxx:443/api/portal/v1.4/proxies/cb0c158c-05d2-4c39-b082-27210808d147

9783   DEBUG APIManagerAPIAdapter| Found: 1 exposed API(s)

9783   DEBUG     APIStatusManager| Desired and actual status equal. No need to update status!

9783   DEBUG APIManagerAPIAdapter| Deleting API-Proxy

9893   INFO  APIManagerAPIAdapter| API: FB_TEST_1888 1.0 (cb0c158c-05d2-4c39-b082-27210808d147) successfully deleted

9893   DEBUG APIManagerAPIAdapter| Deleting API-Proxy

9963   DEBUG APIManagerAPIAdapter| Sending request to find existing APIs: https://xxxxxxx:443/api/portal/v1.4/apirepo?field=name&op=eq&value=FB_TEST_1888&field=createdOn&op=gt&value=1679309274280

14066  DEBUG APIManagerAPIAdapter| No existing API found based on filter: []

14066  INFO       RollbackHandler| Rolled back: '[Frontend-API: false, Backend-API: true]'

14067  ERROR         AppException| Can't create API access requests.

                                 | Failure creating API-Access for application: 'PEPITE'. Error creating/updating API Access.

                                 | Error creating/updating API Access.

                                 | Error creating/updating API Access. Response-Code: 404

com.axway.apim.lib.errorHandling.AppException: Can't create API access requests.

	at com.axway.apim.apiimport.actions.ManageClientApps.createAppSubscription(ManageClientApps.java:128) ~[apimcli-apis-1.12.2.jar:1.12.2]

	at com.axway.apim.apiimport.actions.ManageClientApps.execute(ManageClientApps.java:62) ~[apimcli-apis-1.12.2.jar:1.12.2]

	at com.axway.apim.apiimport.actions.CreateNewAPI.execute(CreateNewAPI.java:80) ~[apimcli-apis-1.12.2.jar:1.12.2]

	at com.axway.apim.apiimport.actions.RecreateToUpdateAPI.execute(RecreateToUpdateAPI.java:36) ~[apimcli-apis-1.12.2.jar:1.12.2]

	at com.axway.apim.apiimport.APIImportManager.applyChanges(APIImportManager.java:54) ~[apimcli-apis-1.12.2.jar:1.12.2]

	at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:103) ~[apimcli-apis-1.12.2.jar:1.12.2]

	at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:58) ~[apimcli-apis-1.12.2.jar:1.12.2]

	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

	at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:141) ~[apimcli-tool-1.12.2.jar:1.12.2]

	at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:77) ~[apimcli-tool-1.12.2.jar:1.12.2]

Caused by: com.axway.apim.lib.errorHandling.AppException: Failure creating API-Access for application: 'PEPITE'. Error creating/updating API Access.

	at com.axway.apim.apiimport.actions.ManageClientApps.createAppSubscription(ManageClientApps.java:123) ~[apimcli-apis-1.12.2.jar:1.12.2]

	... 12 more

Caused by: com.axway.apim.lib.errorHandling.AppException: Error creating/updating API Access.

	at com.axway.apim.adapter.apis.APIManagerAPIAccessAdapter.createAPIAccess(APIManagerAPIAccessAdapter.java:223) ~[apimcli-apim-adapter-1.12.2.jar:1.12.2]

	at com.axway.apim.apiimport.actions.ManageClientApps.createAppSubscription(ManageClientApps.java:121) ~[apimcli-apis-1.12.2.jar:1.12.2]

	... 12 more

Caused by: com.axway.apim.lib.errorHandling.AppException: Error creating/updating API Access. Response-Code: 404

	at com.axway.apim.adapter.apis.APIManagerAPIAccessAdapter.createAPIAccess(APIManagerAPIAccessAdapter.java:206) ~[apimcli-apim-adapter-1.12.2.jar:1.12.2]

	at com.axway.apim.apiimport.actions.ManageClientApps.createAppSubscription(ManageClientApps.java:121) ~[apimcli-apis-1.12.2.jar:1.12.2]

	... 12 more

14073  DEBUG    APIManagerAdapter| Closing cache ...

script returned exit code 60
@fbessai fbessai added the bug Something isn't working label Mar 20, 2023
@rathnapandi rathnapandi self-assigned this Mar 20, 2023
@rathnapandi
Copy link
Member

@fbessai, do you have any load balancer configured for API manager? if so, can you point to API manager directly and test it?

@fbessai
Copy link
Author

fbessai commented Apr 6, 2023

@rathnapandi ,

There is no load balancer on top on the api manager. I suspect the filter date not debing in sync 👍 9963 DEBUG

9963 DEBUG APIManagerAPIAdapter| Sending request to find existing APIs: https://xxxxxxx:443/api/portal/v1.4/apirepo?field=name&op=eq&value=FB_TEST_1888&field=createdOn&op=gt&value=1679309274280

14066 DEBUG APIManagerAPIAdapter| No existing API found based on filter: []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants