kata-ai/kata-cli

Unhandled error when arbitrary version is specified during Kata Init

girikuncoro opened this issue · 1 comments

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

What happened:

Creating new bot with Kata Init on arbitrary version produces unhandled error:

$ kata init testbot-1 testbot 0.1
$ kata push

[ERROR] kata-cli/undefined 2017-11-04 18:34:51 : { Error: Bad Request
    at Request.callback (/usr/local/lib/node_modules/kata-cli/node_modules/zaun/node_modules/superagent/lib/node/index.js:823:17)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/kata-cli/node_modules/zaun/node_modules/superagent/lib/node/index.js:1046:12)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1056:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
  original: null,
  response:
   Response {
     domain: null,
     _events: {},
     _eventsCount: 0,
     _maxListeners: undefined,
     res:
      IncomingMessage {
        _readableState: [Object],
        readable: false,
        domain: null,
        _events: [Object],
        _eventsCount: 4,
        _maxListeners: undefined,
        socket: [Object],
        connection: [Object],
        httpVersionMajor: 1,
        httpVersionMinor: 1,
        httpVersion: '1.1',
        complete: true,
        headers: [Object],
        rawHeaders: [Array],
        trailers: {},
        rawTrailers: [],
        upgrade: false,
        url: '',
        method: null,
        statusCode: 400,
        statusMessage: 'Bad Request',
        client: [Object],
        _consuming: true,
        _dumped: false,
        req: [Object],
        text: '{"message":"insert into `bots` (`descriptor`, `id`, `major`, `minor`, `name`, `patch`, `tag`) values (\'{\\\\\\"id\\\\\\":\\\\\\"test-1\\\\\\",\\\\\\"name\\\\\\":\\\\\\"test\\\\\\",\\\\\\"version\\\\\\":\\\\\\"0.1.undefined\\\\\\",\\\\\\"tag\\\\\\":null,\\\\\\"desc\\\\\\":\\\\\\"Bot Description\\\\\\",\\\\\\"flows\\\\\\":{\\\\\\"fallback\\\\\\":{\\\\\\"priority\\\\\\":0,\\\\\\"fallback\\\\\\":true,\\\\\\"intents\\\\\\":{\\\\\\"hi\\\\\\":{\\\\\\"initial\\\\\\":true,\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"classifier\\\\\\":{\\\\\\"nlu\\\\\\":\\\\\\"confidenceLevel\\\\\\",\\\\\\"match\\\\\\":1}},\\\\\\"dunno\\\\\\":{\\\\\\"fallback\\\\\\":true}},\\\\\\"states\\\\\\":{\\\\\\"init\\\\\\":{\\\\\\"initial\\\\\\":true,\\\\\\"transitions\\\\\\":{\\\\\\"sayHi\\\\\\":{\\\\\\"condition\\\\\\":\\\\\\"intent==\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\"\\\\\\"},\\\\\\"sorry\\\\\\":{\\\\\\"fallback\\\\\\":true}}},\\\\\\"sayHi\\\\\\":{\\\\\\"end\\\\\\":true,\\\\\\"action\\\\\\":[{\\\\\\"name\\\\\\":\\\\\\"sayHi\\\\\\"}]},\\\\\\"sorry\\\\\\":{\\\\\\"end\\\\\\":true,\\\\\\"action\\\\\\":[{\\\\\\"name\\\\\\":\\\\\\"saySorry\\\\\\"}]}},\\\\\\"actions\\\\\\":{\\\\\\"sayHi\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"options\\\\\\":{\\\\\\"data\\\\\\":\\\\\\"$(config.messages)\\\\\\",\\\\\\"path\\\\\\":\\\\\\"templates\\\\\\",\\\\\\"template\\\\\\":\\\\\\"$[sayHi]\\\\\\"}},\\\\\\"saySorry\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"options\\\\\\":{\\\\\\"data\\\\\\":\\\\\\"$(config.messages)\\\\\\",\\\\\\"path\\\\\\":\\\\\\"templates\\\\\\",\\\\\\"template\\\\\\":\\\\\\"$[saySorry]\\\\\\"}}}}},\\\\\\"nlus\\\\\\":{\\\\\\"confidenceLevel\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"method\\\\\\",\\\\\\"method\\\\\\":\\\\\\"confidenceLevel\\\\\\"}},\\\\\\"methods\\\\\\":{\\\\\\"confidenceLevel(message,context,data,options,config)\\\\\\":{\\\\\\"code\\\\\\":\\\\\\"function confidenceLevel(message, context, data, options, config) { if (message.content === \\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\") return 1; return 0; }\\\\\\",\\\\\\"entry\\\\\\":\\\\\\"confidenceLevel\\\\\\"}},\\\\\\"config\\\\\\":{\\\\\\"messages\\\\\\":{\\\\\\"templates\\\\\\":{\\\\\\"sayHi\\\\\\":\\\\\\"Hi, ada yang bisa saya bantu?\\\\\\",\\\\\\"saySorry\\\\\\":\\\\\\"Maaf, saya tidak mengerti kata-kata anda.\\\\\\"}},\\\\\\"maxRecursion\\\\\\":10}}\', \'test-1\', 0, 1, \'test\', NaN, \'latest\') - ER_BAD_FIELD_ERROR: Unknown column \'NaN\' in \'field list\'","status":"error"}',
        read: [Function],
        body: [Object] },
     request:
      Request {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        _agent: false,
        _formData: null,
        method: 'POST',
        url: 'http://zaun.katalabs.io/bots',
        header: [Object],
        writable: true,
        _redirects: 0,
        _maxRedirects: 5,
        cookies: '',
        qs: {},
        qsRaw: [],
        _redirectList: [],
        _streamRequest: false,
        _timeout: 0,
        _data: [Object],
        req: [Object],
        protocol: 'http:',
        host: 'zaun.katalabs.io',
        _callback: [Function],
        _timer: [Object],
        res: [Object],
        response: [Circular],
        called: true },
     req:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 4,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: true,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 1198,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Object],
        connection: [Object],
        _header: 'POST /bots HTTP/1.1\r\nHost: zaun.katalabs.io\r\nAccept-Encoding: gzip, deflate\r\nUser-Agent: node-superagent/1.7.1\r\nAuthorization: Bearer 620bb55e-04c2-4425-b038-0a2f3c96c1ad\r\nContent-Type: application/json\r\nAccept: application/json\r\nContent-Length: 1198\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Object],
        socketPath: undefined,
        timeout: undefined,
        method: 'POST',
        path: '/bots',
        _ended: true,
        res: [Object],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(outHeadersKey)]: [Object] },
     links: {},
     text: '{"message":"insert into `bots` (`descriptor`, `id`, `major`, `minor`, `name`, `patch`, `tag`) values (\'{\\\\\\"id\\\\\\":\\\\\\"test-1\\\\\\",\\\\\\"name\\\\\\":\\\\\\"test\\\\\\",\\\\\\"version\\\\\\":\\\\\\"0.1.undefined\\\\\\",\\\\\\"tag\\\\\\":null,\\\\\\"desc\\\\\\":\\\\\\"Bot Description\\\\\\",\\\\\\"flows\\\\\\":{\\\\\\"fallback\\\\\\":{\\\\\\"priority\\\\\\":0,\\\\\\"fallback\\\\\\":true,\\\\\\"intents\\\\\\":{\\\\\\"hi\\\\\\":{\\\\\\"initial\\\\\\":true,\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"classifier\\\\\\":{\\\\\\"nlu\\\\\\":\\\\\\"confidenceLevel\\\\\\",\\\\\\"match\\\\\\":1}},\\\\\\"dunno\\\\\\":{\\\\\\"fallback\\\\\\":true}},\\\\\\"states\\\\\\":{\\\\\\"init\\\\\\":{\\\\\\"initial\\\\\\":true,\\\\\\"transitions\\\\\\":{\\\\\\"sayHi\\\\\\":{\\\\\\"condition\\\\\\":\\\\\\"intent==\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\"\\\\\\"},\\\\\\"sorry\\\\\\":{\\\\\\"fallback\\\\\\":true}}},\\\\\\"sayHi\\\\\\":{\\\\\\"end\\\\\\":true,\\\\\\"action\\\\\\":[{\\\\\\"name\\\\\\":\\\\\\"sayHi\\\\\\"}]},\\\\\\"sorry\\\\\\":{\\\\\\"end\\\\\\":true,\\\\\\"action\\\\\\":[{\\\\\\"name\\\\\\":\\\\\\"saySorry\\\\\\"}]}},\\\\\\"actions\\\\\\":{\\\\\\"sayHi\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"options\\\\\\":{\\\\\\"data\\\\\\":\\\\\\"$(config.messages)\\\\\\",\\\\\\"path\\\\\\":\\\\\\"templates\\\\\\",\\\\\\"template\\\\\\":\\\\\\"$[sayHi]\\\\\\"}},\\\\\\"saySorry\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"options\\\\\\":{\\\\\\"data\\\\\\":\\\\\\"$(config.messages)\\\\\\",\\\\\\"path\\\\\\":\\\\\\"templates\\\\\\",\\\\\\"template\\\\\\":\\\\\\"$[saySorry]\\\\\\"}}}}},\\\\\\"nlus\\\\\\":{\\\\\\"confidenceLevel\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"method\\\\\\",\\\\\\"method\\\\\\":\\\\\\"confidenceLevel\\\\\\"}},\\\\\\"methods\\\\\\":{\\\\\\"confidenceLevel(message,context,data,options,config)\\\\\\":{\\\\\\"code\\\\\\":\\\\\\"function confidenceLevel(message, context, data, options, config) { if (message.content === \\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\") return 1; return 0; }\\\\\\",\\\\\\"entry\\\\\\":\\\\\\"confidenceLevel\\\\\\"}},\\\\\\"config\\\\\\":{\\\\\\"messages\\\\\\":{\\\\\\"templates\\\\\\":{\\\\\\"sayHi\\\\\\":\\\\\\"Hi, ada yang bisa saya bantu?\\\\\\",\\\\\\"saySorry\\\\\\":\\\\\\"Maaf, saya tidak mengerti kata-kata anda.\\\\\\"}},\\\\\\"maxRecursion\\\\\\":10}}\', \'test-1\', 0, 1, \'test\', NaN, \'latest\') - ER_BAD_FIELD_ERROR: Unknown column \'NaN\' in \'field list\'","status":"error"}',
     body:
      { message: 'insert into `bots` (`descriptor`, `id`, `major`, `minor`, `name`, `patch`, `tag`) values (\'{\\"id\\":\\"test-1\\",\\"name\\":\\"test\\",\\"version\\":\\"0.1.undefined\\",\\"tag\\":null,\\"desc\\":\\"Bot Description\\",\\"flows\\":{\\"fallback\\":{\\"priority\\":0,\\"fallback\\":true,\\"intents\\":{\\"hi\\":{\\"initial\\":true,\\"type\\":\\"text\\",\\"classifier\\":{\\"nlu\\":\\"confidenceLevel\\",\\"match\\":1}},\\"dunno\\":{\\"fallback\\":true}},\\"states\\":{\\"init\\":{\\"initial\\":true,\\"transitions\\":{\\"sayHi\\":{\\"condition\\":\\"intent==\\\\\\"hi\\\\\\"\\"},\\"sorry\\":{\\"fallback\\":true}}},\\"sayHi\\":{\\"end\\":true,\\"action\\":[{\\"name\\":\\"sayHi\\"}]},\\"sorry\\":{\\"end\\":true,\\"action\\":[{\\"name\\":\\"saySorry\\"}]}},\\"actions\\":{\\"sayHi\\":{\\"type\\":\\"text\\",\\"options\\":{\\"data\\":\\"$(config.messages)\\",\\"path\\":\\"templates\\",\\"template\\":\\"$[sayHi]\\"}},\\"saySorry\\":{\\"type\\":\\"text\\",\\"options\\":{\\"data\\":\\"$(config.messages)\\",\\"path\\":\\"templates\\",\\"template\\":\\"$[saySorry]\\"}}}}},\\"nlus\\":{\\"confidenceLevel\\":{\\"type\\":\\"method\\",\\"method\\":\\"confidenceLevel\\"}},\\"methods\\":{\\"confidenceLevel(message,context,data,options,config)\\":{\\"code\\":\\"function confidenceLevel(message, context, data, options, config) { if (message.content === \\\\\\"hi\\\\\\") return 1; return 0; }\\",\\"entry\\":\\"confidenceLevel\\"}},\\"config\\":{\\"messages\\":{\\"templates\\":{\\"sayHi\\":\\"Hi, ada yang bisa saya bantu?\\",\\"saySorry\\":\\"Maaf, saya tidak mengerti kata-kata anda.\\"}},\\"maxRecursion\\":10}}\', \'test-1\', 0, 1, \'test\', NaN, \'latest\') - ER_BAD_FIELD_ERROR: Unknown column \'NaN\' in \'field list\'',
        status: 'error' },
     files: {},
     buffered: true,
     headers:
      { server: 'nginx/1.10.3',
        date: 'Sun, 05 Nov 2017 01:34:50 GMT',
        'content-type': 'application/json; charset=utf-8',
        'content-length': '1910',
        connection: 'close',
        'x-powered-by': 'Express',
        'access-control-allow-origin': '*',
        'access-control-allow-credentials': 'true',
        etag: 'W/"776-YNMTPtgABwLF+yUw/KKWSQzhrlQ"' },
     header:
      { server: 'nginx/1.10.3',
        date: 'Sun, 05 Nov 2017 01:34:50 GMT',
        'content-type': 'application/json; charset=utf-8',
        'content-length': '1910',
        connection: 'close',
        'x-powered-by': 'Express',
        'access-control-allow-origin': '*',
        'access-control-allow-credentials': 'true',
        etag: 'W/"776-YNMTPtgABwLF+yUw/KKWSQzhrlQ"' },
     statusCode: 400,
     status: 400,
     statusType: 4,
     info: false,
     ok: false,
     redirect: false,
     clientError: true,
     serverError: false,
     error:
      { Error: cannot POST /bots (400)
    at Response.toError (/usr/local/lib/node_modules/kata-cli/node_modules/zaun/node_modules/superagent/lib/node/response.js:106:13)
    at Response.setStatusProperties (/usr/local/lib/node_modules/kata-cli/node_modules/zaun/node_modules/superagent/lib/node/response.js:183:12)
    at new Response (/usr/local/lib/node_modules/kata-cli/node_modules/zaun/node_modules/superagent/lib/node/response.js:42:8)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/kata-cli/node_modules/zaun/node_modules/superagent/lib/node/index.js:1042:22)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1056:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
        status: 400,
        text: '{"message":"insert into `bots` (`descriptor`, `id`, `major`, `minor`, `name`, `patch`, `tag`) values (\'{\\\\\\"id\\\\\\":\\\\\\"test-1\\\\\\",\\\\\\"name\\\\\\":\\\\\\"test\\\\\\",\\\\\\"version\\\\\\":\\\\\\"0.1.undefined\\\\\\",\\\\\\"tag\\\\\\":null,\\\\\\"desc\\\\\\":\\\\\\"Bot Description\\\\\\",\\\\\\"flows\\\\\\":{\\\\\\"fallback\\\\\\":{\\\\\\"priority\\\\\\":0,\\\\\\"fallback\\\\\\":true,\\\\\\"intents\\\\\\":{\\\\\\"hi\\\\\\":{\\\\\\"initial\\\\\\":true,\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"classifier\\\\\\":{\\\\\\"nlu\\\\\\":\\\\\\"confidenceLevel\\\\\\",\\\\\\"match\\\\\\":1}},\\\\\\"dunno\\\\\\":{\\\\\\"fallback\\\\\\":true}},\\\\\\"states\\\\\\":{\\\\\\"init\\\\\\":{\\\\\\"initial\\\\\\":true,\\\\\\"transitions\\\\\\":{\\\\\\"sayHi\\\\\\":{\\\\\\"condition\\\\\\":\\\\\\"intent==\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\"\\\\\\"},\\\\\\"sorry\\\\\\":{\\\\\\"fallback\\\\\\":true}}},\\\\\\"sayHi\\\\\\":{\\\\\\"end\\\\\\":true,\\\\\\"action\\\\\\":[{\\\\\\"name\\\\\\":\\\\\\"sayHi\\\\\\"}]},\\\\\\"sorry\\\\\\":{\\\\\\"end\\\\\\":true,\\\\\\"action\\\\\\":[{\\\\\\"name\\\\\\":\\\\\\"saySorry\\\\\\"}]}},\\\\\\"actions\\\\\\":{\\\\\\"sayHi\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"options\\\\\\":{\\\\\\"data\\\\\\":\\\\\\"$(config.messages)\\\\\\",\\\\\\"path\\\\\\":\\\\\\"templates\\\\\\",\\\\\\"template\\\\\\":\\\\\\"$[sayHi]\\\\\\"}},\\\\\\"saySorry\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"text\\\\\\",\\\\\\"options\\\\\\":{\\\\\\"data\\\\\\":\\\\\\"$(config.messages)\\\\\\",\\\\\\"path\\\\\\":\\\\\\"templates\\\\\\",\\\\\\"template\\\\\\":\\\\\\"$[saySorry]\\\\\\"}}}}},\\\\\\"nlus\\\\\\":{\\\\\\"confidenceLevel\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"method\\\\\\",\\\\\\"method\\\\\\":\\\\\\"confidenceLevel\\\\\\"}},\\\\\\"methods\\\\\\":{\\\\\\"confidenceLevel(message,context,data,options,config)\\\\\\":{\\\\\\"code\\\\\\":\\\\\\"function confidenceLevel(message, context, data, options, config) { if (message.content === \\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\") return 1; return 0; }\\\\\\",\\\\\\"entry\\\\\\":\\\\\\"confidenceLevel\\\\\\"}},\\\\\\"config\\\\\\":{\\\\\\"messages\\\\\\":{\\\\\\"templates\\\\\\":{\\\\\\"sayHi\\\\\\":\\\\\\"Hi, ada yang bisa saya bantu?\\\\\\",\\\\\\"saySorry\\\\\\":\\\\\\"Maaf, saya tidak mengerti kata-kata anda.\\\\\\"}},\\\\\\"maxRecursion\\\\\\":10}}\', \'test-1\', 0, 1, \'test\', NaN, \'latest\') - ER_BAD_FIELD_ERROR: Unknown column \'NaN\' in \'field list\'","status":"error"}',
        method: 'POST',
        path: '/bots' },
     accepted: false,
     noContent: false,
     badRequest: true,
     unauthorized: false,
     notAcceptable: false,
     forbidden: false,
     notFound: false,
     charset: 'utf-8',
     type: 'application/json',
     setEncoding: [Function: bound ],
     redirects: [] },
  status: 400 }

How to reproduce it (as minimally and precisely as possible):

$ mkdir testbot && cd testbot
$ kata init testbot-1 testbot 0.1
$ kata push

Anything else we need to know?:

None

Environment:

Kata CLI Version: CLI 1.0
OS: OSx Sierra 10.12

Done in commit ed80405