gpt4 book ai didi

mysql - 类型错误 : Cannot read property 'Symbol(asyncId)' of null

转载 作者:行者123 更新时间:2023-11-29 10:42:27 26 4
gpt4 key购买 nike

我有一个基于node.js的express服务器,它应该处理一些数据库操作。目前,我尝试根据提供的电子邮件获取我的 SQL 数据库的一些信息。在执行下面的操作时,我遇到了一个奇怪的错误。

app.get("/character/:account_email", jsonparser, (req, res) => {
database.query("SELECT account_email, character_name, creation_date, blood, money, experience_points, age, is_alive, place_name FROM vmpr_character WHERE account_email = ?", [req.params.account_email], (error, response, fields) => {
res.set({ "Content-Type": "application/json" });
if (!error) {
res.status(201);
res.write(JSON.stringify(response[0]));

database.query("SELECT attribute_name, level FROM character_attributes JOIN vmpr_character USING (account_email) WHERE character_attributes.account_email = ?", [req.params.account_email], (error2, response2, fields2) => {
if (!error2) {
res.write(JSON.stringify(response2));
} else {
res.status(502);
}
});
} else {
res.status(404);
res.write(JSON.stringify(dummy));
}
res.end();
});
});
<小时/>
TypeError: Cannot read property 'Symbol(asyncId)' of null
at write_ (_http_outgoing.js:636:24)
at ServerResponse.write (_http_outgoing.js:630:10)
at Query.database.query [as _callback] (/Users/nightmare/vmpr/components/database_server/NodeJS/server.js:103:10)
at Query.Sequence.end (/Users/nightmare/vmpr/components/database_server/NodeJS/node_modules/mysql/lib/protocol/sequences/Sequence.js:86:24)
at Query._handleFinalResultPacket (/Users/nightmare/vmpr/components/database_server/NodeJS/node_modules/mysql/lib/protocol/sequences/Query.js:137:8)
at Query.EofPacket (/Users/nightmare/vmpr/components/database_server/NodeJS/node_modules/mysql/lib/protocol/sequences/Query.js:121:8)
at Protocol._parsePacket (/Users/nightmare/vmpr/components/database_server/NodeJS/node_modules/mysql/lib/protocol/Protocol.js:280:23)
at Parser.write (/Users/nightmare/vmpr/components/database_server/NodeJS/node_modules/mysql/lib/protocol/Parser.js:75:12)
at Protocol.write (/Users/nightmare/vmpr/components/database_server/NodeJS/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/Users/nightmare/vmpr/components/database_server/NodeJS/node_modules/mysql/lib/Connection.js:103:28)

将某些数据发布到同一数据库时会发生相同的错误。服务器在 POST 和 GET 上都会崩溃,即使提供的数据仍然正常保存。在 mysql 中执行这些查询直接得到正确的结果。所有日志都很好。

编辑:* 通过提供的更新,错误消失了,新的错误更好处理。* 现在一切都很好。谢谢!

最佳答案

这将在 node v8.2.1 中修复应该会在今天登陆。

关于mysql - 类型错误 : Cannot read property 'Symbol(asyncId)' of null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45224093/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com