Unhandled Rejection [TypeError, Cannot read property 'split' of undefined]

288 views Asked by At

The error given below is causing BotPress v12.21.1 server to crash. It doesn't give any other details about the error. I was getting the same error in BotPress v12.14.1, but it wasn't crashing the server.

Launcher Unhandled Rejection [TypeError, Cannot read property 'split' of undefined]
STACK TRACE
TypeError: Cannot read property 'split' of undefined
    at C:\snapshot\build-windows\out\bp\core\telemetry\stats\sdk-stats.js
    at Array.filter (<anonymous>)
    at SDKStats.parseMethods (C:\snapshot\build-windows\out\bp\core\telemetry\stats\sdk-stats.js)
    at SDKStats.parseFile (C:\snapshot\build-windows\out\bp\core\telemetry\stats\sdk-stats.js)

After the BotPress server restarts twice, I'm getting this error.

Cluster Exceeded the maximum number of automatic server reboot (2). Set the "BP_MAX_SERVER_REBOOT" environment variable to change that

This error is resolved if I remove the code that uses Knex module.

const knex = require('knex')({
      client: 'pg',
      connection: 'postgres://username:password@host:port/dbname',
      pool: { min: 0, max: 10 },
      useNullAsDefault: false,
      log: {
        warn(message) {
          console.log(message)
        },
        error(message) {
          console.error(message)
        },
        deprecate(message) {
          console.log(message)
        },
        debug(message) {
          console.log(message)
        }
      }
    })

It's also resolved if I turn off sendUsageStats.

"sendUsageStats": true

But, both are part of business requirements and I can't use both of these workarounds. Please help me resolve this issue.

1

There are 1 answers

2
Daehli Nadeau-Otis On

Sorry for behind a little bit late on this thread. I was browsing the PR from the botpress repo and one of the PR looks like you issue and another PR here.

Probably I will be fixed in the next release.