Azure / Azure/azure-libraries-for-java

[BUG] Cannot retrieve master key

Abierto
#736 1 comentario 0 reacciones 0 asignados Ver en GitHub
App Services customer-reported Mgmt
Lenguaje dominante
Java
Estrellas
97
Forks
102
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Describe the bug**
After creating the app for functions I can't get the master key, as an unexpected exception is raised.

***Exception or Stack Trace***
```
Exception in thread "main" java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 2]
at rx.exceptions.Exceptions.propagate(Exceptions.java:57)
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:463)
at rx.observables.BlockingObservable.single(BlockingObservable.java:340)
at com.microsoft.azure.management.appservice.implementation.FunctionAppImpl.getMasterKey(FunctionAppImpl.java:227)
at it.unisa.fly.azure.Test.main(Test.java:55)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 2]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:663)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:561)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1892)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:747)
at com.fasterxml.jackson.databind.ObjectReader._initForReading(ObjectReader.java:355)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1596)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1203)
at com.microsoft.rest.serializer.JacksonConverterFactory$JacksonResponseBodyConverter.convert(JacksonConverterFactory.java:99)
at com.microsoft.rest.serializer.JacksonConverterFactory$JacksonResponseBodyConverter.convert(JacksonConverterFactory.java:88)
at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:122)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:217)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:40)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24)
at retrofit2.adapter.rxjava.BodyOnSubscribe.call(BodyOnSubscribe.java:36)
at retrofit2.adapter.rxjava.BodyOnSubscribe.call(BodyOnSubscribe.java:28)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.subscribe(Observable.java:10423)
at rx.Observable.subscribe(Observable.java:10390)
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:443)
... 3 more
```

**To Reproduce**
Steps to reproduce the behavior:
Create an instance of the object azure than follow the code snippet

***Code Snippet***
```
ResourceGroup resourceGroup = azure.resourceGroups()
.define("rgthistest000")
.withRegion(Region.EUROPE_WEST)
.create();
System.out.println("Resource group created");
StorageAccount storageAccount = azure.storageAccounts()
.define("sathistest000")
.withRegion(Region.EUROPE_WEST)
.withExistingResourceGroup(resourceGroup)
.create();
System.out.println("Storage account created");
SkuDescription skuDescription = new SkuDescription()
.withName("Y1")
.withTier("Dynamic")
.withSize("Y1")
.withFamily("Y")
.withCapacity(0);
AppServicePlan appServicePlan = azure.appServices().appServicePlans()
.define("aspthistest000")
.withRegion(Region.EUROPE_WEST)
.withExistingResourceGroup(resourceGroup)
.withPricingTier(PricingTier.fromSkuDescription(skuDescription))
.withOperatingSystem(OperatingSystem.LINUX)
.withPerSiteScaling(false)
.create();
FunctionApp functionApp = azure.appServices().functionApps()
.define("thistest000")
.withExistingAppServicePlan(appServicePlan)
.withExistingResourceGroup(resourceGroup)
.withExistingStorageAccount(storageAccount)
.withAppSetting("FUNCTIONS_WORKER_RUNTIME", "python")
.withLocalGitSourceControl()
.create();
System.out.println("Function app created");

System.out.println(functionApp.getMasterKey()); //Exception is raised here
```

**Expected behavior**
I expected the master key to be returned

**Setup (please complete the following information):**
- OS: Linux
- IDE : Eclipse
- Version of the Library used
```

com.microsoft.azure
azure
1.21.0


commons-net
commons-net
3.3

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza reproduciendo el fragmento de Java proporcionado, centrándote en FunctionApp.getMasterKey y en la entrada del stack trace FunctionAppImpl.getMasterKey. Inspecciona la respuesta antes de que Jackson la analice y, después, verifica que la llamada devuelve la clave maestra esperada en lugar de la respuesta no JSON indicada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
azure, java
Área
backend, cloud
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.