Axway-API-Management-Plus / apim-cli

Axway API-Management CLI - Manage your platform from the command line or with your CI/CD pipeline
Apache License 2.0
45 stars 17 forks source link

NullPointerException Error in updating API with system quotas #475

Closed gcornacchia closed 2 weeks ago

gcornacchia commented 7 months ago

APIM-CLI version

1.14.3

API-Management version

7.7.20211130

Bug description

If I have to update a frontend API (for example because the swagger file has changed) and this API has system quotas configured an NPE error occurs

Steps to reproduce

Consider the following zip file: PetStoreAPI1.0.zip

Step 1) import 1.0 API

> apim.sh API import -c PetStoreAPI1.0.json -s myEnv -retryDelay 3000

Run it twice to avoid error reported in issue #474

Step 2) import 1.1 API

> apim.sh API import -c PetStoreAPI1.1.json -s myEnv -retryDelay 3000

2024-03-21 15:50:03,157 [APIManagerCLI] INFO : API-Manager CLI: 1.14.3 2024-03-21 15:50:03,159 [APIManagerCLI] INFO : Module: API - I M P O R T (1.14.3) 2024-03-21 15:50:03,172 [CoreParameters] INFO : Retrying unexpected API-Manager REST-API responses with a delay of 3000 milliseconds. 2024-03-21 15:50:04,660 [APIManagerAdapter] INFO : Successfully connected to API-Manager (7.7.20211130) on: https://192.168.144.105:8076 2024-03-21 15:50:04,987 [APISpecificationFactory] INFO : Reading API-Definition (Swagger/WSDL) from file: D:\Git\manager\apis\swagger\petstore1.1.json (absolute path) 2024-03-21 15:50:05,009 [APISpecificationFactory] INFO : Detected: Swagger 2.0 specification. 2024-03-21 15:50:05,009 [Swagger2xSpecification] INFO : Overriding host scheme and basePath with value : http://backend 2024-03-21 15:50:05,326 [APIImportConfigAdapter] INFO : Handling configured client-applications. 2024-03-21 15:50:05,327 [APIImportApp] INFO : Lookup actual API based on Path: /petstorewithquota 2024-03-21 15:50:10,765 [APISpecification] INFO : Detected API-Definition-File sizes: API-Manager: 13665 vs Import: 13669 2024-03-21 15:50:11,287 [APIImportManager] INFO : Recognized the following changes. Potentially Breaking: [apiDefinition] plus Non-Breaking: [version, systemQuota] 2024-03-21 15:50:11,288 [APIImportManager] INFO : Is Breaking changes : true Enforce Breaking changes : true 2024-03-21 15:50:11,288 [APIImportManager] INFO : Update API Strategy: Re-Create API as changes can't be applied to existing API. 2024-03-21 15:50:11,288 [RecreateToUpdateAPI] INFO : Create new API to update existing: PetStoreWithQuotaAPI (ID: 38e2ce5e-82d6-4065-841e-b51d53228153) 2024-03-21 15:50:11,834 [CreateNewAPI] INFO : Create published API: PetStoreWithQuotaAPI 1.1 based on Swagger 2.0 specification. 2024-03-21 15:50:13,612 [APIQuotaManager] INFO : Updating System default quota for API: PetStoreWithQuotaAPI 2024-03-21 15:50:13,613 [APIQuotaManager] INFO : Removing existing Quotas for API: PetStoreWithQuotaAPI as quotaMode is set to replace. 2024-03-21 15:50:13,614 [APIManagerAPIMethodAdapter] WARN : No operation found with ID: 8257813b-5ea4-4865-b248-6aa3dde7024a for API: 38e2ce5e-82d6-4065-841e-b51d53228153 2024-03-21 15:50:13,614 [APIImportApp] ERROR: null java.lang.NullPointerException at com.axway.apim.apiimport.actions.APIQuotaManager.populateMethodId(APIQuotaManager.java:130) at com.axway.apim.apiimport.actions.APIQuotaManager.updateRestrictions(APIQuotaManager.java:75) at com.axway.apim.apiimport.actions.APIQuotaManager.execute(APIQuotaManager.java:46) at com.axway.apim.apiimport.actions.CreateNewAPI.execute(CreateNewAPI.java:98) at com.axway.apim.apiimport.actions.RecreateToUpdateAPI.execute(RecreateToUpdateAPI.java:34) at com.axway.apim.apiimport.APIImportManager.applyChanges(APIImportManager.java:76) at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:93) at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:52) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:131) at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:74)

Relevant log output

No response

gcornacchia commented 6 months ago

hi @rathnapandi, any news on this?

gcornacchia commented 5 months ago

ping :)

rathnapandi commented 3 months ago

Hi @gcornacchia,

Can you test it with latest release?

rathnapandi commented 2 weeks ago

Duplicate of #499