gpt4 book ai didi

sequelize.js - 羽毛 Sequelize 不适用于 `` `原始 : false ``` anymore after upgrading to Buzzard

转载 作者:行者123 更新时间:2023-12-03 22:40:36 26 4
gpt4 key购买 nike

我正在使用feathersjs(带有websockets)并在我的服务器上进行 Sequelize 并升级到Buzzard版本。这个钩子(Hook)在我的服务器上,在升级之前可以正常工作:
```

module.exports = function (options = {}) { 
return function (hook) {
if (hook.params.query && hook.params.query.include) {
const joinModel = hook.app.service('favorites_points').Model;
const pointsModel = hook.app.service('points').Model;
hook.params.sequelize = {
raw: false,
include: [{
model: joinModel,
as: 'FavPoints',
include: [{
model: pointsModel
}]
}]
};
delete hook.params.query.include;
}
return Promise.resolve(hook);
};
};

升级后,当从客户端调用时: api.service('users').get(2, {query: {include: true}})
我收到此错误(顺便说一句:当我省略内部 include: [{ model: pointsModel }] 时,仍然存在相同的错误):
index.js?3d97:235 Uncaught (in promise) Error: Maximum call stack size exceeded
at hasBinary (/home/usr/api_server/node_modules/has-binary2/index.js:28:20)
at hasBinary (/home/usr/api_server/node_modules/has-binary2/index.js:35:11)
at hasBinary (/home/usr/api_server/node_modules/has-binary2/index.js:56:59)
at hasBinary (/home/usr/api_server/node_modules/has-binary2/index.js:56:59)
at hasBinary (/home/usr/api_server/node_modules/has-binary2/index.js:56:59)
at hasBinary (/home/usr/api_server/node_modules/has-binary2/index.js:56:59)
at hasBinary (/home/usr/api_server/node_modules/has-binary2/index.js:56:59)
at hasBinary (/home/usr/api_server/node_modules/has-binary2/index.js:56:59)
convert @ index.js?3d97:235
(anonymous) @ client.js?8dbe:71
Socket.onack @ socket.js?0183:312
Socket.onpacket @ socket.js?0183:236
(anonymous) @ index.js?cea2:21
Emitter.emit @ index.js?a675:133
Manager.ondecoded @ manager.js?0ad8:332
(anonymous) @ index.js?cea2:21
Emitter.emit @ index.js?a675:133
Decoder.add @ index.js?5f3d:241
Manager.ondata @ manager.js?0ad8:322
(anonymous) @ index.js?cea2:21
Emitter.emit @ index.js?a675:133
Socket.onPacket @ socket.js?5eac:456
(anonymous) @ socket.js?5eac:273
Emitter.emit @ index.js?a675:133
Transport.onPacket @ transport.js?64e8:145
Transport.onData @ transport.js?64e8:137
ws.onmessage @ websocket.js?7304:147
Promise rejected (async)
queryMe @ Nearby.vue?9ccf:48
boundFn @ vue.runtime.esm.js?ff9b:189
click @ Nearby.vue?dc3e:39
invoker @ vue.runtime.esm.js?ff9b:1979
Vue.$emit @ vue.runtime.esm.js?ff9b:2489
click @ quasar.esm.js?8bfb:3118
boundFn @ vue.runtime.esm.js?ff9b:188
invoker @ vue.runtime.esm.js?ff9b:1979
fn._withTask.fn._withTask @ vue.runtime.esm.js?ff9b:1777

当我注释掉 raw: false, 时,它​​会给出正确的输出。我检查了,但是在我的“升级前版本”中,当我离开 raw: false, 时,查询也可以工作,但是添加时输出结构不同(更多嵌套),所以让我认为 sequelize 只是被规避了,可能没有急切加载等。所以我想使用 raw: false,
为服务器升级 Package.json 后:
"@feathersjs/authentication": "^2.1.0",
"@feathersjs/authentication-jwt": "^1.0.1",
"@feathersjs/authentication-local": "^1.0.2",
"@feathersjs/authentication-oauth2": "^1.0.2",
"@feathersjs/configuration": "^1.0.1",
"@feathersjs/errors": "^3.2.0",
"@feathersjs/express": "^1.1.2",
"@feathersjs/feathers": "https://github.com/feathersjs/feathers.git#master",
"@feathersjs/socketio": "^3.0.1",
"feathers-authentication-hooks": "^0.1.5",
"feathers-hooks-common": "git://github.com/feathers-plus/feathers-hooks-common.git#master",
"feathers-sequelize": "^3.0.0",
"sequelize": "^4.28.6",

在服务器上升级 Package.json 之前:
"feathers": "^2.2.3",
"feathers-authentication": "^1.3.0",
"feathers-authentication-hooks": "^0.1.5",
"feathers-authentication-jwt": "^0.3.2",
"feathers-authentication-local": "^0.4.4",
"feathers-authentication-oauth2": "^0.3.2",
"feathers-blob": "^1.3.1",
"feathers-configuration": "^0.4.2",
"feathers-errors": "^2.9.2",
"feathers-hooks": "^2.1.2",
"feathers-hooks-common": "^3.10.0",
"feathers-rest": "^1.8.1",
"feathers-seeder": "^1.0.10",
"feathers-sequelize": "^2.4.0",
"feathers-socketio": "^2.0.1",
"sequelize": "^4.23.1",

我的问题:为什么它不再适用于 raw: false,,我该如何解决这个问题?

最佳答案

添加 dehydrate hook 后(作为后 Hook )输出如预期。我不清楚为什么在升级之前这不是问题。

关于sequelize.js - 羽毛 Sequelize 不适用于 `` `原始 : false ``` anymore after upgrading to Buzzard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48005984/

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