Azure / Azure/azure-libraries-for-java

[BUG] Cannot retrieve master key

Open
#736 1 comment 0 reactions 0 assignees View on GitHub
App Services customer-reported Mgmt
Dominant language
Java
Stars
97
Forks
102
PR merge metrics
No merged PRs in 30d

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.