highcharts / node-export-server

Highcharts Node.js export server
Other
356 stars 260 forks source link

SyntaxError: Use of reserved word 'let' in strict mode #404

Closed f7h closed 1 year ago

f7h commented 1 year ago

With Version 11.0.0 or higher, 10.3.3 still works, there's the following error when trying to create an image:

phantom worker 4 unexpected data - SyntaxError: Use of reserved word 'let' in strict mode

$ bin/cli.js --batch testcharts/basic.json=basic.png
    __  ___       __         __               __                      
   / / / (_)___ _/ /_  _____/ /_  ____ ______/ /______                
  / /_/ / / __ `/ __ \/ ___/ __ \/ __ `/ ___/ __/ ___/                
 / __  / / /_/ / / / / /__/ / / / /_/ / /  / /_(__  )                 
/_/ /_/_/\__, /_/ /_/\___/_/ /_/\__,_/_/   \__/____/                  
        ____//___/                  __     _____                          
       / ____/  ______  ____  _____/ /_   / ___/___  ______   _____  _____
      / __/ | |/_/ __ \/ __ \/ ___/ __/   \__ \/ _ \/ ___/ | / / _ \/ ___/
     / /____>  </ /_/ / /_/ / /  / /_    ___/ /  __/ /   | |/ /  __/ /    
    /_____/_/|_/ .___/\____/_/   \__/   /____/\___/_/    |___/\___/_/     
              /_/                                                         

                                                                  v2.1.0
Fri Jul 14 2023 11:31:48 GMT+0000 (Coordinated Universal Time) [error] phantom worker 2 unexpected data - SyntaxError: Use of reserved word 'let' in strict mode

  phantomjs://code/worker.js:658 in loop
{"filename":"basic.png"} {
  data: {
    allowCodeExecution: false,
    width: false,
    callback: false,
    resources: false,
    scale: 1,
    constr: 'Chart',
    chart: {
      xAxis: [Object],
      series: [Array],
      chart: [Object],
      exporting: [Object]
    },
    svgstr: undefined,
    format: 'png',
    out: 'basic.png',
    styledMode: false,
    asyncRendering: undefined,
    async: true,
    reqID: '',
    globalOptions: false,
    themeOptions: false,
    customCode: false,
    dataOptions: false,
    id: 2
  },
  working: true,
  ready: false,
  alive: true,
  process: <ref *1> ChildProcess {
    _events: [Object: null prototype] {
      uncaughtException: [Function (anonymous)],
      error: [Function (anonymous)],
      close: [Function (anonymous)]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _closesNeeded: 3,
    _closesGot: 0,
    connected: false,
    signalCode: null,
    exitCode: null,
    killed: false,
    spawnfile: 'node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs',
    _handle: Process {
      onexit: [Function (anonymous)],
      pid: 3423,
      [Symbol(owner_symbol)]: [Circular *1]
    },
    spawnargs: [
      'node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs',
      'node_modules/highcharts-export-server/lib/../phantom/worker.js',
      'node_modules/highcharts-export-server/lib/../'
    ],
    pid: 3423,
    stdin: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _closeAfterHandlingError: false,
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 1,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      [Symbol(async_id_symbol)]: 15,
      [Symbol(kHandle)]: [Pipe],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(kSetKeepAlive)]: false,
      [Symbol(kSetKeepAliveInitialDelay)]: 0,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stdout: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _closeAfterHandlingError: false,
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      [Symbol(async_id_symbol)]: 16,
      [Symbol(kHandle)]: [Pipe],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(kSetKeepAlive)]: false,
      [Symbol(kSetKeepAliveInitialDelay)]: 0,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stderr: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _closeAfterHandlingError: false,
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      [Symbol(async_id_symbol)]: 17,
      [Symbol(kHandle)]: [Pipe],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(kSetKeepAlive)]: false,
      [Symbol(kSetKeepAliveInitialDelay)]: 0,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stdio: [ [Socket], [Socket], [Socket] ],
    [Symbol(kCapture)]: false
  },
  workStartTime: 1689334305611,
  ondone: [Function (anonymous)],
  workcount: 22,
  incoming: "SyntaxError: Use of reserved word 'let' in strict mode\n" +
    '\n' +
    '  phantomjs://code/worker.js:658 in loop\n' +
    '{"filename":"basic.png"}',
  id: 2,
  doDone: [Function: doDone],
  restart: [Function (anonymous)],
  work: [Function (anonymous)],
  allowRestart: true
}
jszuminski commented 1 year ago

Hi,

You're right. Here's a similar issue on our forum - https://www.highcharts.com/forum/viewtopic.php?f=9&t=50838#p186185 where I've explained the source of the problem.

Please test out our new puppeteer-based version - https://github.com/highcharts/node-export-server#puppeteer-version-information where this issue does not occur anymore.