If you try to post data to Solr, you may see these errors:
badMessage: java.lang.IllegalStateException: too much data after closed for HttpChannelOverHttp@19febb04{r=1,c=false,a=IDLE,uri=-} org.noggit.JSONParser$ParseException: Expected quoted string: char=(EOF),position=15 BEFORE=''
This isn’t actually a JSON parsing error – it indicates that the Jetty server cut off the request, which led to failure to parse JSON.
The cause of this is that you need to use chunked encoding in the request payload. If you’re using Node, a lot of examples have you set Content-Length in the post, which implicitly disables chunked encoding:
const postOptions = {
host: 'localhost',
port: 8983,
path: '/solr/talks/update?wt=json',
method: 'POST',
headers: {
'Content-Type': 'text/json',
'Content-Length': Buffer.byteLength(data)
}
}
The fix then, is to simply remove “Content-Length.”