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

"Requested resource doesn't exist" when hitting scroll param #185

Closed
jonnyom opened this issue Feb 28, 2018 · 8 comments
Closed

"Requested resource doesn't exist" when hitting scroll param #185

jonnyom opened this issue Feb 28, 2018 · 8 comments

Comments

@jonnyom
Copy link
Contributor

jonnyom commented Feb 28, 2018

Hitting the scroll() method on the User object returns a NotFoundException.

 public static List<User> scrollUsers(){
        ScrollableUserCollection usersScroll = User.scroll();
        List<User> users = new ArrayList<User>();
        while(usersScroll.scroll()!=null){
            users = usersScroll.getPage();
            usersScroll = usersScroll.scroll();
        }
        return users;
    }

    public static void main( String[] args )
    {
        Intercom.setToken(ACCESS_TOKEN);

        List<User> users = scrollUsers();
        for(User user: users){
            System.out.println(user.getId());
        }

    }

This code returns the following 👇

Exception in thread "main" io.intercom.api.NotFoundException: The requested resource does not exist; check your path and try again
	at io.intercom.api.HttpClient.throwException(HttpClient.java:208)
	at io.intercom.api.HttpClient.handleError(HttpClient.java:169)
	at io.intercom.api.HttpClient.runRequest(HttpClient.java:155)
	at io.intercom.api.HttpClient.executeHttpMethod(HttpClient.java:110)
	at io.intercom.api.HttpClient.get(HttpClient.java:86)
	at io.intercom.api.HttpClient.get(HttpClient.java:82)
	at io.intercom.api.DataResource.scroll(DataResource.java:75)
	at io.intercom.api.User.scroll(User.java:80)
	at ApiTest.scrollUsers(ApiTest.java:55)
	at ApiTest.main(ApiTest.java:79)

Where ApiTest.java:55 corresponds to ScrollableUserCollection usersScroll = User.scroll();

Version info

  • intercom-java version: 2.3.2

Steps to reproduce

  1. Create a new scroll
  2. Try to hit the scroll

Logs

Scroll isn't hitting the /users endpoint at all as it's not being reached

@mkaratkou
Copy link

mkaratkou commented Feb 28, 2018

intercom-sc

That's results of my debugging. io.intercom.api.HttpClient.executeHttpMethod() method, line 112

wrong URI (duplicated slash): https://api.intercom.io//users%2Fscroll

Seems the http client builds wrong URI.
to get the URI I used User::scroll method

client version 2.3.2

@mkaratkou
Copy link

the same issue encountered for 2.2.11 version

intercom-sc-2 2 11

there's a guess that sdk version should be upgraded.
Reproduced on java 1.8:
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
Mac OS High Sierra 10.13.3

Did anyone reproduced that besides me???

@rcauligi
Copy link

rcauligi commented Mar 1, 2018

URIBuilder encodes "/scroll" to "%2Fscroll". This used to work until last week. Poking around, I found that perhaps intercom changed the server side configuration to disallow %2F in the URL
https://stackoverflow.com/questions/3235219/urlencoded-forward-slash-is-breaking-url
specifically, AllowEncodedSlashes directive.
I found the duplicated slash is not a problem, but %2F is. I can reproduce this error in Postman with
https://api.intercom.io/users%2Fscroll with the following response
{
"errors": [
{
"code": "not_found",
"message": "The requested resource does not exist; check your path and try again"
}
],
"type": "error.list"
}

@mkaratkou
Copy link

Hey, guys. Is there any updates?

@mkaratkou
Copy link

Ping

@thewheat
Copy link
Contributor

thewheat commented Mar 5, 2018

Thanks for the investigation @rcauligi and @mkaratkou

I've created a pull request #186 that addresses this problem. Will try get this approved as soon as possible with a new release 👍

Seems that incorrect encoding has been going on from some time and it would have been a bug for our API to accept the incorrect encoding. So the PR I created was to fix this library to call the correct endpoint

@mkaratkou
Copy link

Hey @choran and @rcauligi,

the 2.3.3 version is not uploaded into maven repository - http://jcenter.bintray.com/io/intercom/intercom-java/

Please upload the fixes. We really need them.

@thewheat
Copy link
Contributor

thewheat commented Mar 8, 2018

@mkaratkou we're having a couple of issues publishing the latest release to bintray but we're working our best to publish.

Is it possible to utilise the updated source https://github.com/intercom/intercom-java to use in your project in the mean time to unblock any work for you?

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

4 participants