A service running many days begins to log this error.
Error: spawn E2BIG
at ChildProcess.spawn (node:internal/child_process:413:11)
at Object.spawn (node:child_process:700:9)
at PDF.PdfExec [as exec] (/app/node_modules/html-pdf/lib/pdf.js:89:28)
at PDF.PdfToFile [as toFile] (/app/node_modules/html-pdf/lib/pdf.js:85:8)
at Observable._subscribe (/app/node_modules/rxjs/dist/cjs/internal/observable/bindCallbackInternals.js:73:30)
at Observable._trySubscribe (/app/node_modules/rxjs/dist/cjs/internal/Observable.js:41:25)
at /app/node_modules/rxjs/dist/cjs/internal/Observable.js:35:31
at Object.errorContext (/app/node_modules/rxjs/dist/cjs/internal/util/errorContext.js:22:9)
at Observable.subscribe (/app/node_modules/rxjs/dist/cjs/internal/Observable.js:26:24)
at AsapAction. (/app/node_modules/rxjs/dist/cjs/internal/operators/subscribeOn.js:8:71)
at AsapAction.AsyncAction._execute (/app/node_modules/rxjs/dist/cjs/internal/scheduler/AsyncAction.js:76:18)
at AsapAction.AsyncAction.execute (/app/node_modules/rxjs/dist/cjs/internal/scheduler/AsyncAction.js:64:26)
at AsapScheduler.flush (/app/node_modules/rxjs/dist/cjs/internal/scheduler/AsapScheduler.js:33:33)
at /app/node_modules/rxjs/dist/cjs/internal/util/Immediate.js:21:74
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
The line mentioned in log is
var child = childprocess.spawn(this.options.phantomPath, [].concat(this.options.phantomArgs, [this.script]), this.options.childProcessOptions)
In my local environment printed the content of this.options.phantomArgs, which is an array, bigger and bigger in each execution. For example
First execution:
[ '--local-url-access=false' ]
Second execution:
[ '--local-url-access=false', '--local-url-access=false' ]
Third execution:
[
'--local-url-access=false',
'--local-url-access=false',
'--local-url-access=false'
]
and so on until reach the supported max command length, throwing E2BIG exception.
Hi!
A service running many days begins to log this error.
Error: spawn E2BIG at ChildProcess.spawn (node:internal/child_process:413:11) at Object.spawn (node:child_process:700:9) at PDF.PdfExec [as exec] (/app/node_modules/html-pdf/lib/pdf.js:89:28) at PDF.PdfToFile [as toFile] (/app/node_modules/html-pdf/lib/pdf.js:85:8) at Observable._subscribe (/app/node_modules/rxjs/dist/cjs/internal/observable/bindCallbackInternals.js:73:30) at Observable._trySubscribe (/app/node_modules/rxjs/dist/cjs/internal/Observable.js:41:25) at /app/node_modules/rxjs/dist/cjs/internal/Observable.js:35:31 at Object.errorContext (/app/node_modules/rxjs/dist/cjs/internal/util/errorContext.js:22:9) at Observable.subscribe (/app/node_modules/rxjs/dist/cjs/internal/Observable.js:26:24) at AsapAction. (/app/node_modules/rxjs/dist/cjs/internal/operators/subscribeOn.js:8:71)
at AsapAction.AsyncAction._execute (/app/node_modules/rxjs/dist/cjs/internal/scheduler/AsyncAction.js:76:18)
at AsapAction.AsyncAction.execute (/app/node_modules/rxjs/dist/cjs/internal/scheduler/AsyncAction.js:64:26)
at AsapScheduler.flush (/app/node_modules/rxjs/dist/cjs/internal/scheduler/AsapScheduler.js:33:33)
at /app/node_modules/rxjs/dist/cjs/internal/util/Immediate.js:21:74
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
The line mentioned in log is
var child = childprocess.spawn(this.options.phantomPath, [].concat(this.options.phantomArgs, [this.script]), this.options.childProcessOptions)
In my local environment printed the content of
this.options.phantomArgs
, which is an array, bigger and bigger in each execution. For exampleFirst execution: [ '--local-url-access=false' ]
Second execution: [ '--local-url-access=false', '--local-url-access=false' ]
Third execution: [ '--local-url-access=false', '--local-url-access=false', '--local-url-access=false' ]
and so on until reach the supported max command length, throwing E2BIG exception.
Thanks in advanced. Marcelo.