Azure / Azure/azure-libraries-for-java

[BUG] Cannot retrieve master key

Đang mở
#736 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
App Services customer-reported Mgmt
Ngôn ngữ chính
Java
Star
97
Fork
102
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện đoạn mã Java được cung cấp, tập trung vào FunctionApp.getMasterKey và mục nhập stack trace FunctionAppImpl.getMasterKey. Kiểm tra response trước khi Jackson phân tích nó, sau đó xác minh rằng lệnh gọi trả về khóa chính mong đợi thay vì response không phải JSON được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
azure, java
Lĩnh vực
backend, cloud
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.