apim-cli icon indicating copy to clipboard operation
apim-cli copied to clipboard

Error reading application permissions. Error: Cannot coerce empty String ("") to com.axway.apim.api.model.apps.ApplicationPermission$SharePermission value

Open saper opened this issue 1 year ago • 0 comments

APIM-CLI version

1.14.4+ e6d2e54d2932529d572b78649f16d38af231706b

API-Management version

7.7.20230228

Bug description

apim -s my-environment app get -id 3a73b789-8cc2-4d04-b5a1-dd3797371022 -o json fails with an exception fetch app permissions.

Steps to reproduce

This fails for any app in my environment I have checked.

It breaks with -o json, -o yaml.

It works OK with -o csv, -wide and -ultra.

Relevant log output

2024-07-05 13:52:50,815 [APIManagerCLI] INFO : API-Manager CLI: 1.14.5-SNAPSHOT
2024-07-05 13:52:50,817 [APIManagerCLI] DEBUG: Java Version: 21.0.3
2024-07-05 13:52:50,817 [APIManagerCLI] INFO : Module: Application - E X P O R T / U T I L S  (1.14.5-SNAPSHOT)
2024-07-05 13:52:50,832 [EnvironmentProperties] DEBUG: Trying to load environment properties from file: /u/extcieslak/src/apim-cli-1.14.5-SNAPSHOT/conf/env.properties ... not found.
2024-07-05 13:52:50,837 [EnvironmentProperties] DEBUG: Loaded environment properties from file: /u/extcieslak/src/apim-cli-1.14.5-SNAPSHOT/conf/env.ews-emea.properties
2024-07-05 13:52:51,766 [APIMHttpClient] DEBUG: API Manager CLI http client timeout : 30000
2024-07-05 13:52:51,770 [APIMHttpClient] DEBUG: API Manager CLI using Http(s) proxy : localhost
2024-07-05 13:52:51,806 [RestAPICall] DEBUG: Http verb:POST and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/login
2024-07-05 13:52:52,311 [RestAPICall] DEBUG: Http verb:GET and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/currentuser
2024-07-05 13:52:52,401 [APIManagerOrganizationAdapter] WARN : Using OrgAdmin only to load all organizations.
2024-07-05 13:52:52,401 [APIManagerOrganizationAdapter] DEBUG: Load organizations from API-Manager using filter: OrgFilter [name=null, id=8ef7fc60-3f01-4d79-ae70-a292a5a90449]
2024-07-05 13:52:52,401 [APIManagerOrganizationAdapter] DEBUG: Load organization with URI: https://affected.gatway.example.com:8075/api/portal/v1.4/organizations/8ef7fc60-3f01-4d79-ae70-a292a5a90449
2024-07-05 13:52:52,402 [RestAPICall] DEBUG: Http verb:GET and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/organizations/8ef7fc60-3f01-4d79-ae70-a292a5a90449
2024-07-05 13:52:52,423 [APIManagerOrganizationAdapter] DEBUG: Organization id to be cached : /8ef7fc60-3f01-4d79-ae70-a292a5a90449
2024-07-05 13:52:52,448 [RestAPICall] DEBUG: Http verb:GET and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/config
2024-07-05 13:52:52,492 [APIManagerAdapter] INFO : Organization Administrator Self Service Enabled : false
2024-07-05 13:52:52,492 [APIManagerAdapter] INFO : Successfully connected to API-Manager (7.7.20230228) on: https://affected.gatway.example.com:8075
2024-07-05 13:52:52,494 [APIManagerCustomPropertiesAdapter] DEBUG: Read configured custom properties from API-Manager
2024-07-05 13:52:52,494 [RestAPICall] DEBUG: Http verb:GET and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/config/customproperties
2024-07-05 13:52:52,558 [APIManagerOrganizationAdapter] WARN : Using OrgAdmin only to load all organizations.
2024-07-05 13:52:52,559 [APIManagerOrganizationAdapter] DEBUG: Load organizations from API-Manager using filter: OrgFilter [name=null, id=307b0653-271b-41fb-9ef9-2cd29a15da16]
2024-07-05 13:52:52,559 [APIManagerOrganizationAdapter] DEBUG: Load organization with URI: https://affected.gatway.example.com:8075/api/portal/v1.4/organizations/307b0653-271b-41fb-9ef9-2cd29a15da16
2024-07-05 13:52:52,559 [RestAPICall] DEBUG: Http verb:GET and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/organizations/307b0653-271b-41fb-9ef9-2cd29a15da16
2024-07-05 13:52:52,594 [APIManagerOrganizationAdapter] DEBUG: Organization id to be cached : /307b0653-271b-41fb-9ef9-2cd29a15da16
2024-07-05 13:52:52,597 [APIMgrAppsAdapter] DEBUG: Found: 1 applications
2024-07-05 13:52:52,606 [RestAPICall] DEBUG: Http verb:GET and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/applications/b87e8c3a-a33f-465d-bdc2-29fac88abcef/oauthresource
2024-07-05 13:52:52,633 [RestAPICall] DEBUG: Http verb:GET and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/applications/b87e8c3a-a33f-465d-bdc2-29fac88abcef/permissions
2024-07-05 13:52:52,660 [APIManagerAdapter] DEBUG: Closing cache ...
2024-07-05 13:52:52,724 [RestAPICall] DEBUG: Http verb:DELETE and URI: https://affected.gatway.example.com:8075/api/portal/v1.4/login
2024-07-05 13:52:52,748 [ApplicationExportApp] ERROR: Can't initialize API-Manager API-Representation.
                                 | Error reading application permissions. Error: Cannot coerce empty String ("") to `com.axway.apim.api.model.apps.ApplicationPermission$SharePermission` value (but could if coercion was enabled using `CoercionConfig`)
 at [Source: (String)"[{"id":"d977d300-4d35-41f1-a88c-1d4b313323d3","userId":"815e1a5b-6c63-41df-8d96-3dd682bc59ca","permission":"","createdBy":"63680303-0794-40a7-af6f-8c90fdcdd006","createdOn":1680350735455}]"; line: 1, column: 108] (through reference chain: java.util.ArrayList[0]->com.axway.apim.api.model.apps.ApplicationPermission["permission"])
com.axway.apim.lib.error.AppException: Can't initialize API-Manager API-Representation.
        at com.axway.apim.adapter.client.apps.APIMgrAppsAdapter.getApplications(APIMgrAppsAdapter.java:142)
        at com.axway.apim.appexport.ApplicationExportApp.runExport(ApplicationExportApp.java:114)
        at com.axway.apim.appexport.ApplicationExportApp.export(ApplicationExportApp.java:90)
        at com.axway.apim.appexport.ApplicationExportApp.export(ApplicationExportApp.java:54)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:130)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:72)
Caused by: com.axway.apim.lib.error.AppException: Error reading application permissions. Error: Cannot coerce empty String ("") to `com.axway.apim.api.model.apps.ApplicationPermission$SharePermission` value (but could if coercion was enabled using `CoercionConfig`)
 at [Source: (String)"[{"id":"d977d300-4d35-41f1-a88c-1d4b313323d3","userId":"815e1a5b-6c63-41df-8d96-3dd682bc59ca","permission":"","createdBy":"63680303-0794-40a7-af6f-8c90fdcdd006","createdOn":1680350735455}]"; line: 1, column: 108] (through reference chain: java.util.ArrayList[0]->com.axway.apim.api.model.apps.ApplicationPermission["permission"])
        at com.axway.apim.adapter.client.apps.APIMgrAppsAdapter.addApplicationPermissions(APIMgrAppsAdapter.java:283)
        at com.axway.apim.adapter.client.apps.APIMgrAppsAdapter.getApplications(APIMgrAppsAdapter.java:133)
        ... 7 more
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot coerce empty String ("") to `com.axway.apim.api.model.apps.ApplicationPermission$SharePermission` value (but could if coercion was enabled using `CoercionConfig`)
 at [Source: (String)"[{"id":"d977d300-4d35-41f1-a88c-1d4b313323d3","userId":"815e1a5b-6c63-41df-8d96-3dd682bc59ca","permission":"","createdBy":"63680303-0794-40a7-af6f-8c90fdcdd006","createdOn":1680350735455}]"; line: 1, column: 108] (through reference chain: java.util.ArrayList[0]->com.axway.apim.api.model.apps.ApplicationPermission["permission"])
        at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:67)
        at com.fasterxml.jackson.databind.DeserializationContext.reportBadCoercion(DeserializationContext.java:1817)
        at com.fasterxml.jackson.databind.deser.std.StdDeserializer._checkCoercionFail(StdDeserializer.java:1662)
        at com.fasterxml.jackson.databind.deser.std.EnumDeserializer._deserializeAltString(EnumDeserializer.java:364)
        at com.fasterxml.jackson.databind.deser.std.EnumDeserializer._fromString(EnumDeserializer.java:279)
        at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.deserialize(EnumDeserializer.java:248)
        at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:359)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3755)
        at com.axway.apim.adapter.client.apps.APIMgrAppsAdapter.addApplicationPermissions(APIMgrAppsAdapter.java:273)
        ... 8 more

saper avatar Jul 05 '24 11:07 saper