Above is a sample search response, sometimes while searching we get alerts field which breaks our code, can you please give a sample response to how it looks like when we get alerts and warnings in response,
I wasn't able to find it in any documentation, so it would be of great help if some one from appsearch team shares a sample response.
According to our OpenAPI spec (not sure if that's published publicly anywhere or not)
alerts are both string arrays.
In what way is it breaking your code?
Hi @JasonStoltz I am getting JSON parse error
JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
Can you please share a example. it would be of great help, as we are not able to replicate this issue
If anyone could share a sample response having "alerts" present it would be of great help ,Thank you.
Interesting. So it looks like you're receiving an object in a field instead of a string. Is it definitely the
If so, does this happen intermittently or consistently? Production or development?
Are you able to just ignore the alerts field when parsing the response for now?
This happens intermittently, perhaps when appsearch has heavy load,
Sadly we are not able to replicate it.
alerts field is currently hardcoded to always be an empty array. Could it be another field causing this issue?
We get this error :
Error while extracting response for type [class SearchResponse] and content type [application/json;charset=utf-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (PushbackInputStream); line: 1, column: 99] (through reference chain: model.SearchResponse["meta"]->model.Meta["alerts"]->java.util.ArrayList)
We get this error intermittently, could it be app-search sends another response when its experiencing heavy load.
@Subhasis_Dash Got it. That doesn't give me a lot to work off of. If you are able to log the API responses so we can see exactly what you're getting in the response, and is causing the error, that would be extremely helpful.
You may also be able to find this in the API logs for your engine.
Unfortunately with the high no of logs we are not able to do that.
The way I'm reading that error is that alerts is correctly an empty array (
java.util.ArrayList ) but your code is trying to read it as a
Another possibility is that you're seeing a 500 / 503 and your code is looking to parse values that don't exist in that case.
Either way, you'll really need to be able to determine what the actual API response looks like to determine why your parsing logic is failing.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.