Azure / Azure/azure-libraries-for-java

[BUG] Cannot retrieve master key

Ouverte
#736 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
App Services customer-reported Mgmt
Langage dominant
Java
Étoiles
97
Forks
102
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

**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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par reproduire l’extrait Java fourni, en vous concentrant sur FunctionApp.getMasterKey et sur l’entrée de la trace de pile FunctionAppImpl.getMasterKey. Inspectez la réponse avant que Jackson ne l’analyse, puis vérifiez que l’appel renvoie la clé maître attendue plutôt que la réponse non JSON signalée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
azure, java
Domaine
backend, cloud
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.