question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeserializationError: Unexpected end of JSON input

See original GitHub issue

🐛 Bug Report

We are making Elasticsearch queries in a test file. The test file has multiple tests, each performing a query. We tried reordering the tests in the file and found that the first test in the file will be the only one that fails. Even with a stripped down body for the query, we are still inconsistently getting the following error:

image Text: “DeserializationError: Unexpected end of JSON input”

To Reproduce

Run the following test multiple times (it takes a variable number of attempts to get the failure):

import { Client } from '@elastic/elasticsearch

const defaultClient = new Client({
    node: host,
    sniffOnStart: true
})

describe('elastic test', () => {
    test('it should not have deserialization errors', async () => {
        await defaultClient.search({
            index: 'common',
            type: '_doc',
            body: {
                query: {
                    match_all: {}
                }
            }
        })
    })
})

Expected behavior

The test should be passing consistently.

Your Environment

  • node version: 10.11.0
  • @elastic/elasticsearch version: ^7.5.1
  • os: Mac
  • Elasticsearch instance version: 7.4.2

Please let me know if you need any additional information!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:33 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
apoorvHearthcommented, Feb 23, 2020

I am facing the exact similar issue from some days now, the configuration is exactly identical and the bug is also the same as well. The JSON response is broken inside the _source field from random places.

3reactions
delvedorcommented, Nov 10, 2020

Hello! #1343 has landed, it will be available in 7.10 soon 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

XSA ODATA V4 POST Error - {code: "400" Deserialization ...
{code: "400", message: "Deserialization Error: Unexpected end of JSON input."}. Using XSA 2.0 SPS05, Backend is NODE (Project Template - SAP ...
Read more >
Error : SyntaxError: Unexpected end of JSON input
I am trying to fetch a JSON file from a api website using the below code but i am getting an error saying...
Read more >
Unexpected end of JSON input Error in JavaScript - Stack Diary
The "Unexpected end of JSON input" error is a syntax error that occurs when the JSON you're trying to parse is incomplete or...
Read more >
DeserializationError: Unexpected end of JSON input
Bug Report. We are making Elasticsearch queries in a test file. The test file has multiple tests, each performing a query.
Read more >
Unexpected end of JSON input Error in JavaScript | bobbyhadz
The "Unexpected end of JSON input" error occurs when trying to parse invalid JSON using the JSON.parse or $.parseJSON methods. Trying to parse...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found