Skip to content

pricing.js:530 JSON parse failse (broken chunk?) #4

@frankmasonus

Description

@frankmasonus

For whatever reason, fails always on XAU/USD

error: uncaughtException: Unexpected end of JSON input date=Mon Jan 22 2018 10:54:22 GMT-0500 (EST), pid=17684, uid=501, gid=20, cwd=/Users/me/depot/backoffice/utils, execPath=/Users/me/.nvm/versions/node/v8.6.0/bin/node, version=v8.6.0, argv=[/Users/me/.nvm/versions/node/v8.6.0/bin/node, /Users/me/depot/backoffice/utils/stream.js], rss=35946496, heapTotal=15269888, heapUsed=11493680, external=108305, loadavg=[2.79296875, 2.89208984375, 2.9814453125], uptime=142613
SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at /Users/me/depot/backoffice/utils/node_modules/@oanda/v20/pricing.js:530:32
at chunks.forEach.chunk (/Users/me/depot/backoffice/utils/node_modules/@oanda/v20/context.js:133:33)
at Array.forEach ()
at IncomingMessage.response.on.d (/Users/me/depot/backoffice/utils/node_modules/@oanda/v20/context.js:130:32)
at emitOne (events.js:115:13)
at IncomingMessage.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
at readableAddChunk (_stream_readable.js:253:11)
at IncomingMessage.Readable.push (_stream_readable.js:211:10)
error: uncaughtException: Parse Error date=Mon Jan 22 2018 10:54:22 GMT-0500 (EST), pid=17684, uid=501, gid=20, cwd=/Users/me/depot/backoffice/utils, execPath=/Users/me/.nvm/versions/node/v8.6.0/bin/node, version=v8.6.0, argv=[/Users/me/.nvm/versions/node/v8.6.0/bin/node, /Users/me/depot/backoffice/utils/stream.js], rss=36257792, heapTotal=15269888, heapUsed=11751584, external=108539, loadavg=[2.79296875, 2.89208984375, 2.9814453125], uptime=142613
Error: Parse Error
at TLSSocket.socketOnData (_http_client.js:454:20)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
at readableAddChunk (_stream_readable.js:253:11)
at TLSSocket.Readable.push (_stream_readable.js:211:10)
at TLSWrap.onread (net.js:587:20)
Response {
method: 'GET',
path: '/v3/accounts/101-001-5495877-001/pricing/stream?instruments=,EUR/USD,GBP/USD,USD/JPY,XAU/USD,USD/CHF,EUR/CHF,AUD/USD,USD/CAD,NZD/USD,EUR/GBP&snapshot=true&',
statusCode: '200',
statusMessage: 'OK',
contentType: 'application/octet-stream',
rawBody: '{"type":"PRICE","time":"2018-01-22T15:54:22.661804860Z","bids":[{"price":"1334.848","liquidity":1000},{"price":"1334.768","liquidity":1000},{"price":"1334.728","liquidity":1000},{"price":"1334.648","liquidity":1000},{"price":"1334.548","liquidity":1000}],"asks":[{"price":"1335.138","liquidity":1000},{"price":"1335.218","liquidity":1000},{"price":"1335.25',
body: null }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions