Javascript MySQL - TypeError:无法读取null的属性'embed'

时间:2017-06-24 06:25:25

标签: mysql node.js database properties typeerror

我正在尝试将选择查询日志中的结果输出到控制台,但我得到以下内容:

代码:

connection.query("SELECT userID FROM inventories WHERE ?", invCheckedIDres, function(result) {
  message.channel.send(result)
});

错误:

C:\Users\apixe\Documents\GS Bot\node_modules\mysql\lib\protocol\Parser.js:79
        throw err; // Rethrow non-MySQL errors
        ^

TypeError: Cannot read property 'embed' of null
    at TextChannel.send (C:\Users\apixe\Documents\GS Bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:83:16)
    at Query._callback (C:\Users\apixe\Documents\GS Bot\index.js:811:19)
    at Query.Sequence.end (C:\Users\apixe\Documents\GS Bot\node_modules\mysql\lib\protocol\sequences\Sequence.js:86:24)
    at Query._handleFinalResultPacket (C:\Users\apixe\Documents\GS Bot\node_modules\mysql\lib\protocol\sequences\Query.js:137:8)
    at Query.EofPacket (C:\Users\apixe\Documents\GS Bot\node_modules\mysql\lib\protocol\sequences\Query.js:121:8)
    at Protocol._parsePacket (C:\Users\apixe\Documents\GS Bot\node_modules\mysql\lib\protocol\Protocol.js:280:23)
    at Parser.write (C:\Users\apixe\Documents\GS Bot\node_modules\mysql\lib\protocol\Parser.js:75:12)
    at Protocol.write (C:\Users\apixe\Documents\GS Bot\node_modules\mysql\lib\protocol\Protocol.js:39:16)
    at Socket.<anonymous> (C:\Users\apixe\Documents\GS Bot\node_modules\mysql\lib\Connection.js:103:28)
    at emitOne (events.js:115:13)

这里有什么我想念的吗?

1 个答案:

答案 0 :(得分:0)

您使用哪个模块进行sql集成?

您没有将其记录到控制台,您正在向discord发送消息。查询返回row / rows []对象,而message.send也接受字符串,而不是行。但是,我没有在您提供的代码中看到任何内容正在访问&#34;嵌入&#34;这段代码来自哪个行号?