omise/omise-node

Got an "Unexpected end of JSON input" error

Closed this issue · 3 comments

PanJ commented

Hi,

We got this Unexpected end of JSON input error in about 1% of the transaction. I have tried to investigate the library itself but could not find anything. I will try again with DEBUG_OMISE=true and wait for the issue to occur. I'm still not sure if the problem is the library itself or the response from the server is invalid JSON format.

Here's error message.

error:  SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at IncomingMessage.<anonymous> (/app/node_modules/omise/lib/api.js:20:23)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:975:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
zdk commented

Hi @PanJ
That could likely be non-completed response where network communication involved.
And, If you have found more details, please let's us know.
Thanks.

What behavior should be when found json syntax error?

Close due to inactivity.