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

Unexpected character ('<') error processing Java SDK response payload

Open mattdonnelly opened this issue 5 years ago • 11 comments

This error does not occur consistently but there have been multiple reports of it. It possibly happens when the API times out and we try to parse the response. We should handle this case more gracefully.

Logs

[81da96743b246a37] could not parse error response: [Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: (sun.net.www.protocol.http.HttpURLConnection$HttpInputStream); line: 1, column: 2]] com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: (sun.net.www.protocol.http.HttpURLConnection$HttpInputStream); line: 1, column: 2] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804) ~[jackson-core-2.9.6.jar:2.9.6]

mattdonnelly avatar Jan 08 '20 11:01 mattdonnelly

I'm experiencing the same issue. This is happening on user update calls. Had several occur at 6:20, 6:29, and 6:34 pm CST on Jan 09, 2020. It seems to be very intermittent issue but I can't identify a cause.

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@5d32eec6; line: 1, column: 2] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2689) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:878) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:772) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3850) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2924) at io.intercom.api.HttpClient.handleError(HttpClient.java:162) at io.intercom.api.HttpClient.runRequest(HttpClient.java:155) at io.intercom.api.HttpClient.executeHttpMethod(HttpClient.java:110) at io.intercom.api.HttpClient.post(HttpClient.java:100) at io.intercom.api.DataResource.update(DataResource.java:35) at io.intercom.api.User.update(User.java:55)

PatrickDugan42 avatar Jan 10 '20 17:01 PatrickDugan42

customer's error message:

2020-01-08 10:56:52,447 [blendernetworks] [173.230.149.47] [pool-3-thread-2660] WARN SsaIntercomEventTask:e= error{code='unprocessable_entity', message='could not parse error response: [Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@338c1002; line: 1, column: 2]] logged with code [ee6a7dd7b27107b3]'} io.intercom.api.Error@76200492

gabrielbreshears avatar Jan 10 '20 21:01 gabrielbreshears

Customer wrote in again looking for updates

"Please don't forget to keep me posted regarding the intermittent API issue . It's important because requests are not being handled and data integrity is damaged."

gabrielbreshears avatar Feb 04 '20 21:02 gabrielbreshears

I am seeing this as well - I think that occasionally we get an error page with HTML, which starts with a '<' rather than JSON characters. There were 4 events in the latest <storm, 2 at 2020-02-19T01:00:48.521Z and 2 at 2020-02-19T01:00:41.426Z. It would be awesome to cut these off my list of alerts.

AdamRaken avatar Feb 19 '20 01:02 AdamRaken

It also happened to me as well.

Handling JsonParseException by myself is quiet strange to me, (code readability point of view) Please make error response as json format. At least handle JsonParseException inside Intercom lib and convert it into something like IntercomException.

nootherday avatar Mar 04 '20 03:03 nootherday

Happens to me as well. [ERROR] [pool-30-thread-1] [2020-Oct-21 13:00:19 PM] [intercom-java] - [2d139b11bddf109c] could not parse error response: [Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')

lukashruby avatar Oct 22 '20 11:10 lukashruby

Anyone has solution? I met the same error, kinda of blocked here.

JialieY avatar Mar 05 '21 18:03 JialieY

@JialieY you need to use restTemplate.getInterceptors()

sanketkhandekar86 avatar Mar 05 '21 18:03 sanketkhandekar86

getting error

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: (byte[])"<HEAD><TITLE>Request on loopback from external IP</TITLE></HEAD>

bettercallavi avatar Apr 20 '21 12:04 bettercallavi

Has anyone found a fix to this error?

Bolajiadesina avatar Jun 29 '21 13:06 Bolajiadesina

Any solution for this issue???

tesfai-optum avatar Jun 06 '22 12:06 tesfai-optum