Request Error: Parse Error.
-
jsReport: 2.1.0
Hi guys, we are experiencing the following error during the trial of our jsreport solution for one of the projects.
At first I was suspecting the the corporate proxy (as we are experiencing the troubles with it), but then I've realized that this error shows up before the
beforeRender(..)
lifecycle hook. This happens perhaps 1 out of 10 times, so in 9 cases it works all good.Any ideas what and why would be throwing this error?
(jsreport config is below it)
Thanks
RequestError: Error: Parse Error at new RequestError (D:\jsreport-2.1\node_modules\request-promise-core\lib\errors.js:14:15) at Request.plumbing.callback (D:\jsreport-2.1\node_modules\request-promise-core\lib\plumbing.js:87:29) at Request.RP$callback [as _callback] (D:\jsreport-2.1\node_modules\request-promise-core\lib\plumbing.js:46:31) at self.callback (D:\jsreport-2.1\node_modules\request\request.js:186:22) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at Request.onRequestError (D:\jsreport-2.1\node_modules\request\request.js:878:8) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at TLSSocket.socketOnData (_http_client.js:445:9) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:594:20)
{ "extensions": { "authentication": { "cookieSession": { "secret": "<your strong secret here>" }, "admin": { "username": "admin", "password": "password" }, "enabled": false }, "scripts": { "allowedModules": [ "request", "q", "request-promise", "http", "https", "terraformer", "terraformer-arcgis-parser", "proj4", "moment", "win-ca", "node-forge" ], "timeout": 40000, "strategy": "http-server" } }, "httpPort": 5454, "store": { "provider": "fs" }, "blobStorage": { "provider": "fs" }, "logger": { "console": { "transport": "console", "level": "debug" }, "file": { "transport": "file", "level": "debug", "filename": "logs/reporter.log" }, "error": { "transport": "file", "level": "error", "filename": "logs/error.log" } }, "allowLocalFilesAccess": true, "templatingEngines": { "timeout": 10000, "strategy": "http-server" }, "chrome": { "timeout": 40000 } }
-
Please share the relevant content from
reporter.log
.
The stack trace doesn't say where in particular it fails.It can be the
request
module we use to communicate with the child processes when the"strategy": "http-server"
.
Perhaps you could change it to default to see if this is the real problem.Or it can be
request
module you use in a script to make an API call.
-
Hi Jan,
Only now I'm back in the office. Well, that was the excerpt from the reporter log. I'll try to remove the
http-server
strategy to see if it helps. Below is the excerpt from the reporter.log that is from one run that leads to failure.In my script, in
beforeRender
lifecycle hook, I have a console log message to indicate that it has entered the script, but it all fails before that. In the script, there are only import declarations, hence I don't think it's therequest
module problem, but I'm not saying it's not.thanks
2018-10-25T08:06:37.135Z - info: Starting rendering request 54 (user: null) 2018-10-25T08:06:37.137Z - info: Rendering template { name: BWM-IR, recipe: phantom-pdf, engine: handlebars, preview: false } 2018-10-25T08:06:37.138Z - debug: Data item not defined for this template. 2018-10-25T08:06:37.138Z - debug: Resources not defined for this template. 2018-10-25T08:06:37.140Z - debug: Executing script bwm-ir 2018-10-25T08:06:41.363Z - warn: Error when processing render request Error: Parse Error RequestError: Error: Parse Error at new RequestError (D:\jsreport-2.1\node_modules\request-promise-core\lib\errors.js:14:15) at Request.plumbing.callback (D:\jsreport-2.1\node_modules\request-promise-core\lib\plumbing.js:87:29) at Request.RP$callback [as _callback] (D:\jsreport-2.1\node_modules\request-promise-core\lib\plumbing.js:46:31) at self.callback (D:\jsreport-2.1\node_modules\request\request.js:186:22) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at Request.onRequestError (D:\jsreport-2.1\node_modules\request\request.js:878:8) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at TLSSocket.socketOnData (_http_client.js:445:9) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:594:20) 2018-10-25T08:06:41.364Z - warn: Error during processing request at http://.......:5454/templates/ByP_MsDLm
-
Hi again, well, it seems like it is on of the (many) requests I make and I will probably have to blame the proxy, but I really don't know how will I resolve this sort of problem. It's getting the
HPE_INVALID_CHUNK_SIZE
error down the track. Any ideas?2018-10-26T04:06:41.381Z - debug: Error in Areas: { RequestError: Error: Parse Error at new RequestError (D:\jsreport-2.1\node_modules\request-promise-core\lib\errors.js:14:15) at Request.plumbing.callback (D:\jsreport-2.1\node_modules\request-promise-core\lib\plumbing.js:87:29) at Request.RP$callback [as _callback] (D:\jsreport-2.1\node_modules\request-promise-core\lib\plumbing.js:46:31) at self.callback (D:\jsreport-2.1\node_modules\request\request.js:186:22) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at Request.onRequestError (D:\jsreport-2.1\node_modules\request\request.js:878:8) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at TLSSocket.socketOnData (_http_client.js:445:9) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:594:20) name: 'RequestError', message: 'Error: Parse Error', cause: { Error: Parse Error at TLSSocket.socketOnData (_http_client.js:440:20) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:594:20) bytesParsed: 3, code: 'HPE_INVALID_CHUNK_SIZE' }, error: { Error: Parse Error at TLSSocket.socketOnData (_http_client.js:440:20) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:594:20) bytesParsed: 3, code: 'HPE_INVALID_CHUNK_SIZE' }, options: { rejectUnauthorized: false, proxy: <someproxyhere>', method: 'GET', uri: '<url>', qs: { f: 'json', where: '1=1', outfields: '*', returnGeometry: true, token: '<token>', orderByFields: 'LABEL' }, headers: { 'Cache-Control': 'no-cache' }, json: true, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: undefined } 2018-10-26T04:06:41.396Z - debug: --> Error in getAllData ---| { RequestError: Error: Parse Error at new RequestError (D:\jsreport-2.1\node_modules\request-promise-core\lib\errors.js:14:15) at Request.plumbing.callback (D:\jsreport-2.1\node_modules\request-promise-core\lib\plumbing.js:87:29) at Request.RP$callback [as _callback] (D:\jsreport-2.1\node_modules\request-promise-core\lib\plumbing.js:46:31) at self.callback (D:\jsreport-2.1\node_modules\request\request.js:186:22) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at Request.onRequestError (D:\jsreport-2.1\node_modules\request\request.js:878:8) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at TLSSocket.socketOnData (_http_client.js:445:9) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:594:20) name: 'RequestError', message: 'Error: Parse Error', cause: { Error: Parse Error at TLSSocket.socketOnData (_http_client.js:440:20) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:594:20) bytesParsed: 3, code: 'HPE_INVALID_CHUNK_SIZE' }, error: { Error: Parse Error at TLSSocket.socketOnData (_http_client.js:440:20) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:594:20) bytesParsed: 3, code: 'HPE_INVALID_CHUNK_SIZE' }, options: { rejectUnauthorized: false, proxy: '<proxy>', method: 'GET', uri: '<url>', qs: { f: 'json', where: '1=1', outfields: '*', returnGeometry: true, token: '<token>', orderByFields: 'LABEL' }, headers: { 'Cache-Control': 'no-cache' }, json: true, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: undefined }
-
Hm. Yes it seems to be crashing in your script. I haven't experience such problem so don't know what to recommend.
I would try a different lib like axios or native http module to make request.
If it doesn't help you will have to try fixing your proxy or make sure that the endpoints your are calling actually works correctly.
Maybe you get the same error even when running without proxy.