intercom-java icon indicating copy to clipboard operation
intercom-java copied to clipboard

Finding Contacts or Users Returns Deserialization Error

Open eugenedw opened this issue 3 years ago • 4 comments

Please use the following template to submit your issue. Following this template will allow us to quickly investigate and help you with your issue. Please be aware that issues which do not conform to this template may be closed.

For feature requests please contact us at [email protected]

Version info

  • intercom-java version: 2.8.2
  • Java version: JDK 1.8

Expected behavior

We expect that the Contact.list() call would return a list of contacts within our account

Actual behavior

Exception is thrown when the method is called which states that there was a problem deserializing the results. The error is as follows (some data intentionally obfuscated):

io.intercom.api.IntercomException: Local exception calling [https://api.intercom.io//contacts]. Check connectivity and settings. [Cannot deserialize instance of `java.net.URI` out of START_OBJECT token at [Source: (String)"{"type":"list","data":[{"type":"contact","id":"5841261218edxxxxxxxxxxxf","workspace_id":"fxxxxxx","external_id":"XXXXXX","role":"user","email":"[email protected]","phone":null,"name":"grplife Support","avatar":null,"owner_id":null,"social_profiles":{"type":"list","data":[]},"has_hard_bounced":false,"marked_email_as_spam":false,"unsubscribed_from_emails":false,"created_at":1480664594,"updated_at":1621052695,"signed_up_at":1480664594,"last_seen_at":1621051681,"last_replied_at":1519342044,"last_con"[truncated 15983 chars]; line: 1, column: 16352] (through reference chain: io.intercom.api.ContactCollection["pages"]->java.util.LinkedHashMap["next"])]

Steps to reproduce

  1. Initialize the object with the account api token Intercom.setToken('xxxxxxxx');
  2. Execute a request to gather the list of contacts ContactCollection contacts = Contact.list();
  3. Try to access the returned data (no dice)
      while( contacts.hasNext() && c == null ){
	 c = contacts.next();
      }

Logs

Here are some more logs:

io.intercom.api.IntercomException: Local exception calling [https://api.intercom.io//contacts]. Check connectivity and settings. [Cannot deserialize instance of `java.net.URI` out of START_OBJECT token at [Source: (String)"{"type":"list","data":[{"type":"contact","id":"5841261218edxxxxxxxxxxxf","workspace_id":"fxxxxxx","external_id":"XXXXXX","role":"user","email":"[email protected]","phone":null,"name":"grplife Support","avatar":null,"owner_id":null,"social_profiles":{"type":"list","data":[]},"has_hard_bounced":false,"marked_email_as_spam":false,"unsubscribed_from_emails":false,"created_at":1480664594,"updated_at":1621052695,"signed_up_at":1480664594,"last_seen_at":1621051681,"last_replied_at":1519342044,"last_con"[truncated 15983 chars]; line: 1, column: 16352] (through reference chain: io.intercom.api.ContactCollection["pages"]->java.util.LinkedHashMap["next"])]

	at io.intercom.api.HttpClient.throwLocalException(HttpClient.java:124)
	at io.intercom.api.HttpClient.executeHttpMethod(HttpClient.java:112)
	at io.intercom.api.HttpClient.get(HttpClient.java:86)
	at io.intercom.api.HttpClient.get(HttpClient.java:82)
	at io.intercom.api.DataResource.list(DataResource.java:66)
	at io.intercom.api.Contact.list(Contact.java:50)
	at com.carmel.intercom.business.IntercomIntegrationService.generateTrialAccount(IntercomIntegrationService.java:60)
	at com.carmel.service.IntercomIntegrationTest.testTrailAccountCreate(IntercomIntegrationTest.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.net.URI` out of START_OBJECT token
 at [Source: (String)"{"type":"list","data":[{"type":"contact","id":"5841261218ed0xxxxxxxxxx","workspace_id":"fxxxxxx","external_id":"XXXXXX","role":"user","email":"[email protected]","phone":null,"name":"grplife Support","avatar":null,"owner_id":null,"social_profiles":{"type":"list","data":[]},"has_hard_bounced":false,"marked_email_as_spam":false,"unsubscribed_from_emails":false,"created_at":1480664594,"updated_at":1621052695,"signed_up_at":1480664594,"last_seen_at":1621051681,"last_replied_at":1519342044,"last_con"[truncated 15983 chars]; line: 1, column: 16352] (through reference chain: io.intercom.api.ContactCollection["pages"]->java.util.LinkedHashMap["next"])
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
	at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1343)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1139)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1093)
	at com.fasterxml.jackson.databind.deser.std.FromStringDeserializer.deserialize(FromStringDeserializer.java:177)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:527)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
	at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3042)
	at io.intercom.api.HttpClient.readEntity(HttpClient.java:192)
	at io.intercom.api.HttpClient.handleSuccess(HttpClient.java:176)
	at io.intercom.api.HttpClient.runRequest(HttpClient.java:153)
	at io.intercom.api.HttpClient.executeHttpMethod(HttpClient.java:110)
	... 29 more

Disconnected from the target VM, address: '127.0.0.1:55247', transport: 'socket'

Process finished with exit code 255

eugenedw avatar May 15 '21 05:05 eugenedw

Digging around in the Intercom Developer Hub, I suspected this might be due to a version mismatch. After trying several past versions, the test eventually worked when I landed on 1.4, from September 2019.

Screen Shot 2021-05-14 at 10 17 16 PM

Are there plans to update the api to support the latest Intercom version (2.3)?

eugenedw avatar May 15 '21 05:05 eugenedw

I am interested in this too. Same issue

andreiowv avatar Jun 08 '21 13:06 andreiowv

Also interested

eduardoloop avatar Nov 11 '21 10:11 eduardoloop

Also interested as got the same issue here and for us finding by email is a key requirement

pwragg avatar Aug 10 '22 16:08 pwragg