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.

Uncaught SyntaxError: Unexpected end of JSON input

See original GitHub issue

I am getting this error on reload of the client, otherwise seems to work. image

index.html#/:1 Uncaught SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at IncomingMessage.eval (eval at <anonymous> (bundle.js:4112), <anonymous>:108:31)
    at emitNone (events.js:91)
    at IncomingMessage.emit (events.js:188)
    at endReadableNT (_stream_readable.js:975)
    at _combinedTickCallback (internal/process/next_tick.js:80)
    at process._tickCallback (internal/process/next_tick.js:104)
(anonymous)	@	request.js?c6b6:75
emitNone	@	events.js:91
emit	@	events.js:188
endReadableNT	@	_stream_readable.js:975
_combinedTickCallback	@	internal/process/next_tick.js:80
_tickCallback	@	internal/process/next_tick.js:104

Server is running origin/cardano-sl-1.0 front end is running daedalus master

Here is where it is happening in request.js

   response.on('end', () => {
        const parsedBody = JSON.parse(body);

The this.req.res.statusCode== 404 and is not being checked.

Now there are two files that look very similar: https://github.com/input-output-hk/daedalus/blob/master/app/api/etc/lib/request.js#L36 and https://github.com/input-output-hk/daedalus/blob/master/app/api/ada/lib/request.js#L75

Body is empty:

screenshot from 2017-12-18 07-48-40

The incoming message is a 404 not found!

IncomingMessage {_readableState: ReadableState, readable: false, domain: null, _events: EventHandlers, _eventsCount: 3…}
statusCode:404
statusMessage :"Not Found"

The request is “/api/settings/time/difference”

Here is what I found in the _header : .req.socket._httpMessage._header

“GET /api/settings/time/difference HTTP/1.1 Host: localhost:8090 Connection: close”



Posted on Utopian.io - Rewarding Open Source Contributors

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
h4ck3rm1k3commented, Jan 6, 2018

the api is there is in the unreleased version I am using. https://github.com/input-output-hk/cardano-sl/commit/58bd3caab1779b2cd71f0298bc18f766cdd80ab8#diff-1cd0b0acca347cce42b9aea9b5122eed

See https://github.com/input-output-hk/cardano-sl/blob/429efc2426c63802ae86789f5b828dcbb42de88a/wallet-new/README.md

Currently the only way to generate an updated swagger.json is to run the wallet-new-server node, so that the updated Swagger file will be written on disk. For example:

stack exec wallet-new-server -- --topology=wallet-new/topology-examples/testnet.yaml \
  --configuration-key mainnet_staging_short_epoch_full --wallet-debug --rebuild-db
0reactions
nikolaglumaccommented, Jan 30, 2019

This issue is no longer reproducible in the latest Daedalus version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught SyntaxError: Unexpected end of JSON input
A common error encountered by JavaScript programmers is the Uncaught SyntaxError: Unexpected end of JSON input. This is usually observed when the coder...
Read more >
Uncaught SyntaxError: Unexpected end of JSON input at ...
When you try to parse it as JSON it is converted to a string ( "" ), which is empty, so you reach...
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 >
“Unexpected end of JSON input” – possible fixes - LinuxPip
“Unexpected end of JSON input” (or “Uncaught SyntaxError: Unexpected end of JSON input”) is a common error message in JavaScript, ...
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 >

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