In this article, I am going to explain a bug that I had to solve in an application that is responsible for saving data in a non-relational database.
This API is responsible for processing data sent by a third party and stores it in a non-relational database. This third party sends the information to this REST API through webhooks that periodically send statistical data.
Well, one of the fields that this third party sends is a numeric value that was bigger than the value that the API expects (that in this case was an
Integer). This implies that when receiving the data at the endpoint it would give the following error:
com.fasterxml.jackson.databind.JsonMappingException: Numeric value (1657567761206) out of range of int
The solution to the problem was to change the data type from
Long. This way the error disappeared and the API could save the data back to the non-relational database.
This happened because this third party sent the data using an
Integer and then without prior notice, they changed the data type to a
How did I catch the error?
I realized that there was an error in the application logs using Kibana. Also, because there was no data in the metrics as previously and this triggered an alarm that it’s configured by Grafana (read this post that I wrote some time ago if you want to know more) that sends a warning to a Slack channel.
In this article we have seen a bug that was in production and how when doing the fix in the API it was possible to process the data as before.