Yelp / yelp-android

MIT License
55 stars 36 forks source link

InvalidSignature #46

Open MalcolmMcFly opened 7 years ago

MalcolmMcFly commented 7 years ago

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());
                }
            });
tzuhanwu commented 7 years ago

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.

MalcolmMcFly commented 7 years ago

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)

tzuhanwu commented 7 years ago

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?

MalcolmMcFly commented 7 years ago

@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.

tzuhanwu commented 7 years ago

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

MalcolmMcFly commented 7 years ago

@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.

jgphilip commented 7 years ago

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?

tzuhanwu commented 7 years ago

@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?

MalcolmMcFly commented 7 years ago

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.