`raw: false,` does not work with with Buzzard
See original GitHub issueThis hook on my server:
module.exports = function (options = {}) { // eslint-disable-line no-unused-vars
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;
}
When called from client with (I am using websockets):
api.service('users').get(2, {query: {include: true}})
Gives this error (btw: when I leave out the inner include: [{ model: pointsModel }]
, same error remains):
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
When I comment out raw: false,
it gives proper output.
This hook worked fine with raw: false,
before upgrading to feathers Buzzard (with matching assistance libraries). My current package.json for the server has these:
"@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",
What is going on? Why does my query suddenly work without raw: false,
??
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
feathers-sequelize does not work with ```raw: false``` anymore ...
After adding a dehydrate hook (as an after hook) the output is as expected. It's not clear to me why before upgrading this...
Read more >Can not get registered user after upgrading to Buzzard · Issue #759 ...
Everything seems to work now except that I can not get the user that ... Model; hook.params.sequelize = { raw: false, include: [{...
Read more >One year ago today, Mercy the Buzzard debuted on Raw ...
I was so disappointed when I saw Bray Wyatt debut in the Firefly funhouse. I am very happy with how wrong I ultimately...
Read more >Buzzard's Beat - There is a post going around that attributes ...
That reasoning is absolutely false. Malarky. The actual reason for color difference (from a PhD meat scientist I know) is: "The one in...
Read more >What Not To Serve Buzzards For Lunch, A Glorious Science ...
The painting, curiously, helped solve the puzzle, which is: How do vultures find food? James Audubon stairs at at vulture in a tree....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just wanted to leave a comment here for some closure. By default, sequelize defaults to
raw: true
. This was a controversial decision, but the reason behind the decision was so that feathers-sequelize could interoperate with other hooks, especially feathers-hooks-commom. As soon as you setraw: false
, feathers-sequelize should not work with common hooks.You say that using
raw: false
did work before the upgrade, but if it did it was merely a fluke and you likely found an edge case where it worked. As it stands, here are the general rules with regard to feathers-sequelize.raw: true
by default), everything should work out of the box, even with 3rd party (common) hooks.include
option), you should setraw: false
. This will give you properly nested data (this is a shortcoming of sequelize).raw: false
AND want to use 3rd party (common) hooks, you MUSTdeydrate()
the data first as 3rd party hooks cannot work with sequelize instances.Hope that helps anybody else coming here. If you still have questions, come to the “sequelize” room in Feather’s Slack.
After adding a dehydrate hook (as an after hook) the output is as expected. Not clear to me why before upgrading this was not an issue…