yelp-android icon indicating copy to clipboard operation
yelp-android copied to clipboard

InvalidSignature

Open MalcolmMcFly opened this issue 8 years ago • 9 comments

I receive this error quite a bit when invoking the Search endpoint:

com.yelp.clientlib.exception.exceptions.InvalidSignature

An issue was closed last month that had some similarities (Issue #36), but I'm not sure it was fully resolved as the solution was listed as simply just using RX libraries.

Here is give or take my exact implementation, some days it works, some days I get the above error:

            YelpAPIFactory apiFactory = new YelpAPIFactory(Constants.YELP_CONSUMER_KEY,
                    Constants.YELP_CONSUMER_SECRET,
                    Constants.YELP_TOKEN,
                    Constants.YELP_TOKEN_SECRET);
            YelpAPI yelpAPI = apiFactory.createAPI();

            Map<String, String> params = new HashMap<>();

            // general params
            params.put("limit", "10");
            params.put("radius_filter","16094");
            params.put("actionlinks","true");
            params.put("term", "restaurants");
            params.put("cll", latitude + "," + longitude);

            final Call<SearchResponse> yelpDataCall = yelpAPI.search(getCity(latitude,longitude), params);
            yelpDataCall.enqueue(new Callback<SearchResponse>() {
                @Override
                public void onResponse(Call<SearchResponse> call, Response<SearchResponse> response) {
                    int statusCode = response.code();
                    SearchResponse yelpData = response.body();
                }

                @Override
                public void onFailure(Call<SearchResponse> call, Throwable t) {
                    // com.yelp.clientlib.exception.exceptions.InvalidSignature
                    Log.d("Yelp", t.toString());
                }
            });

MalcolmMcFly avatar Feb 21 '17 11:02 MalcolmMcFly

Hello @MalcolmMcFly, thanks for reporting this issue. I saw you are logging the stacktrace, do you mind to share one? (Please remove any key or sensitive data from the string) Thanks.

tzuhanwu avatar Feb 21 '17 17:02 tzuhanwu

My apologies, I should have included this the first time:

D/Fragment:145: Response error code: com.yelp.clientlib.exception.exceptions.InvalidSignature: D/Fragment:146: GET <-- https://api.yelp.com/v2/search?location=Los%20Angeles&radius_filter=16094&actionlinks=true&sort=1&limit=10&cll=34.052234,-118.243685&term=restaurants W/System.err: com.yelp.clientlib.exception.exceptions.InvalidSignature: W/System.err: at com.yelp.clientlib.exception.ErrorHandlingInterceptor.parseError(ErrorHandlingInterceptor.java:85) W/System.err: at com.yelp.clientlib.exception.ErrorHandlingInterceptor.intercept(ErrorHandlingInterceptor.java:45) W/System.err: at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190) W/System.err: at se.akerfeldt.okhttp.signpost.SigningInterceptor.intercept(SigningInterceptor.java:46) W/System.err: at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190) W/System.err: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163) W/System.err: at okhttp3.RealCall.access$100(RealCall.java:30) W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127) W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) W/System.err: at java.lang.Thread.run(Thread.java:761)

MalcolmMcFly avatar Feb 22 '17 04:02 MalcolmMcFly

I failed to reproduce this.

@MalcolmMcFly, you say this error happens occasionally, is there any other thing you observes that might help on debugging? When the error happens, does that happen on few queries or does that happen for the whole day? Does this happen on other endpoints for you?

tzuhanwu avatar Feb 28 '17 07:02 tzuhanwu

@tzuhanwu It's actually been occurring several days in a row now with no hint to why. I am currently in Thailand, with the geolocation settings of my emulator set to California if that means anything. Would sending you a gist with the fragment calling the API help at all? I am not seeing any additional error outside of the one I posted above.

[UPDATE] - Just emailed gist.

MalcolmMcFly avatar Feb 28 '17 08:02 MalcolmMcFly

Interesting, I'll see whether I can reproduce that.

tzuhanwu avatar Feb 28 '17 17:02 tzuhanwu

@tzuhanwu I can confirm it works on an actual Android device. Now investigating why it doesn't work on the emulator.

I will monitor this over the next couple of days to see if anything changes.

MalcolmMcFly avatar Mar 01 '17 12:03 MalcolmMcFly

I am experiencing a similar issue on my Android device. I am hitting the APIs from India. Is my location the reason for the Invalid Signature error?

jgphilip avatar Mar 11 '17 21:03 jgphilip

@MalcolmMcFly, how are the things going? Are you still experiencing the problem with emulator?

@jgphilip, have you tried to run on emulator? Does the API work for you on emulator?

tzuhanwu avatar Mar 22 '17 06:03 tzuhanwu

I am no longer using this API, sorry I cannot provide more details. I was not able to figure out what the underlying issue was.

MalcolmMcFly avatar Jun 06 '17 13:06 MalcolmMcFly