Last active
December 14, 2015 15:08
-
-
Save jbeard4/5105097 to your computer and use it in GitHub Desktop.
possible sails bug regarding policy chaining
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This illustrates a possible bug in sails. | |
Steps to replicate. Submit a form once, then submit it again. The server will break. | |
This only occurs when using policy chaining, as rolling back the policy chaining (using only one policy per action) seems to resolve the issue. | |
Steps taken to resolve: I edited /sails/lib/scaffolds/controller.js:133:17 to change `res.json(values)` to `res.send(JSON.stringify(values))`. I did this, as I reasoned that this would avoid writing 'Content-Type : application/json' headers to the response. This changed the behaviour such that it caused the connection to hang on the second POST - a response would never be sent, and the connection would be held open. | |
I will attempt to create a reduced test case later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jbeard4@ps16821:~/workspace/testProject$ sails lift | |
debug: Starting server in /home/jbeard4/workspace/testProject... | |
verbose: Loading module sails-mysql... | |
info - socket.io started | |
debug: | |
debug: | |
debug: | |
debug: | |
debug: <| | |
debug: | | |
debug: \\____// | |
debug: --___---___--___---___--___---___ | |
debug: --___---___--___---___--___---___ | |
debug: | |
debug: Sails lifted on port 1337 in development mode. | |
debug: | |
debug: ( to see your app, visit: http://localhost:1337 ) | |
^[[B^[[B^[[BComparing password with hashed password test $2a$10$U.akKXaJh9Chu2mhg98N1.sXp8tyUMJvpsbS0FPuNGT3yxF2tDyV. | |
in authenticated | |
in addCreatedBy | |
Total Pollens is now 0.64 | |
Total Mold Spores is now 0.208 | |
verbose: Published [object Object] to sails_c_create_biologicalreport | |
verbose: Introduced model sails_c_biologicalreport_14 | |
in authenticated | |
in addCreatedBy | |
Total Pollens is now 0.64 | |
Total Mold Spores is now 0.208 | |
verbose: Published [object Object] to sails_c_create_biologicalreport | |
verbose: Introduced model sails_c_biologicalreport_15 | |
http.js:673 | |
throw new Error('Can\'t set headers after they are sent.'); | |
^ | |
Error: Can't set headers after they are sent. | |
at ServerResponse.OutgoingMessage.setHeader (http.js:673:11) | |
at ServerResponse.res.setHeader (/home/jbeard4/.nvm/v0.8.21/lib/node_modules/sails/node_modules/connect/lib/patch.js:62:20) | |
at ServerResponse.res.header (/home/jbeard4/workspace/testProject/node_modules/sails/node_modules/express/lib/response.js:280:8) | |
at ServerResponse.res.json (/home/jbeard4/workspace/testProject/node_modules/sails/node_modules/express/lib/response.js:135:8) | |
at exports.definition.actions.create (/home/jbeard4/workspace/testProject/node_modules/sails/lib/scaffolds/controller.js:133:17) | |
at module.exports.done (/home/jbeard4/workspace/testProject/node_modules/sails/lib/waterline/deferredObject.js:167:12) | |
at async.forEachSeries.iterate (/home/jbeard4/workspace/testProject/node_modules/sails/node_modules/async/lib/async.js:116:25) | |
at promiseCallback (/home/jbeard4/workspace/testProject/node_modules/sails/lib/waterline/deferredObject.js:162:13) | |
at /home/jbeard4/workspace/testProject/node_modules/sails/lib/waterline/collection.js:649:10 | |
at Quit.module.exports._.extend.host [as _callback] (/home/jbeard4/workspace/testProject/node_modules/sails-mysql/MySQLAdapter.js:61 | |
6:12) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment