intercom-java
intercom-java copied to clipboard
Unexpected character ('<') error processing Java SDK response payload
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]
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)
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
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."
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.
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.
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')
Anyone has solution? I met the same error, kinda of blocked here.
@JialieY you need to use restTemplate.getInterceptors()
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>
Has anyone found a fix to this error?
Any solution for this issue???