Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonSyntaxException when getting the stats for a subscription #355

Open
zailushangde opened this issue Jul 7, 2020 · 1 comment
Open

Comments

@zailushangde
Copy link

The Nakadi consumer (V0.14.0) throws the exception, when trying to get the statistics by nakadiClient.resources.subscriptions().stats(subscriptionId):

nakadi.shadow.com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at nakadi.shadow.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
at nakadi.shadow.com.google.gson.Gson.fromJson(Gson.java:887)
at nakadi.shadow.com.google.gson.Gson.fromJson(Gson.java:852)
at nakadi.shadow.com.google.gson.Gson.fromJson(Gson.java:801)
at nakadi.shadow.com.google.gson.Gson.fromJson(Gson.java:773)
at nakadi.GsonSupport.fromJson(GsonSupport.java:73)
at nakadi.ProblemSupport.toProblem(ProblemSupport.java:9)
at nakadi.OkHttpResource.handleError(OkHttpResource.java:314)
at nakadi.OkHttpResource.throwIfError(OkHttpResource.java:301)
at nakadi.OkHttpResource.requestThrowingInner(OkHttpResource.java:168)
at nakadi.OkHttpResource.requestThrowingInner(OkHttpResource.java:177)
at nakadi.OkHttpResource.lambda$requestThrowing$2(OkHttpResource.java:113)
at nakadi.shadow.io.reactivex.internal.operators.observable.ObservableDefer.subscribeActual(ObservableDefer.java:32)
at nakadi.shadow.io.reactivex.Observable.subscribe(Observable.java:10842)
at nakadi.shadow.io.reactivex.Observable.blockingFirst(Observable.java:4727)
at nakadi.OkHttpResource.requestThrowing(OkHttpResource.java:113)
at nakadi.SubscriptionResourceReal.loadStatsPage(SubscriptionResourceReal.java:232)
at nakadi.SubscriptionResourceReal.stats(SubscriptionResourceReal.java:167)
at nakadiClient.resources.subscriptions().stats(subscriptionId)
...
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at nakadi.shadow.com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at nakadi.shadow.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
... 32 common frames omitted

However, it returns the expected payload by calling the API directly:

http https://$HOST/subscriptions/$SUS_ID/stats Authorization:"Bearer $token)"
HTTP/1.1 200 OK
{
    "items": [
        {
            "event_type": "xxxx",
            "partitions": [
                {
                    "assignment_type": "auto",
                    "partition": "0",
                    "state": "assigned",
                    "stream_id": "xxx",
                    "unconsumed_events": 100
                },
...
}
@zailushangde
Copy link
Author

it proves to be the 429 error was returned and the response body is not in JSON format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant