Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crashes on load with error #4

Open
seethun opened this issue Mar 25, 2019 · 2 comments
Open

Application crashes on load with error #4

seethun opened this issue Mar 25, 2019 · 2 comments

Comments

@seethun
Copy link

seethun commented Mar 25, 2019

Sails version: 1.1.0
Node version: v11.0.0
NPM version: 6.9.0
DB adapter name: sails-mysql
DB adapter version: 1.0.1
Operating system: ubuntu


I installed this module, and customized the findOne blueprint action in /api/blueprints as documented. I get the following error when loading the application, and the application crashes on load. Please help

Steps to reproduce error:

cd testproject; cp node_modules/sails/lib/hooks/blueprints/actions/findOne.js api/blueprints

commented out this line in api/blueprints/findOne.js:
//queryOptions.criteria.where = _.pick(queryOptions.criteria.where, Model.primaryKey);

sails lift

I get the following error message on sails lift - and the application crashes:

``
...
info: ✓ Auto-migration complete.


WARNING: Something seems to be wrong with this function.
It is trying to signal that it has finished AGAIN, after
already resolving/rejecting once.
(silently ignoring this...)

To assist you in hunting this down, here is a stack trace:

    at Object.releaseConnection (/home/ubuntu/dev/testproject/node_modules/sails-mysql/helpers/private/connection/release-connection.js:27:9)
    at buildIndexesCb (/home/ubuntu/dev/testproject/node_modules/sails-mysql/helpers/define.js:143:30)
    at /home/ubuntu/dev/testproject/node_modules/sails-mysql/node_modules/async/dist/async.js:486:20
    at replenish (/home/ubuntu/dev/testproject/node_modules/sails-mysql/node_modules/async/dist/async.js:879:29)
    at iterateeCallback (/home/ubuntu/dev/testproject/node_modules/sails-mysql/node_modules/async/dist/async.js:869:21)
    at /home/ubuntu/dev/testproject/node_modules/sails-mysql/node_modules/async/dist/async.js:847:20
    at Object.success (/home/ubuntu/dev/testproject/node_modules/sails-mysql/helpers/private/query/run-native-query.js:64:14)
    at /home/ubuntu/dev/testproject/node_modules/machine/lib/private/help-build-machine.js:1517:30
    at proceedToFinalAfterExecLC (/home/ubuntu/dev/testproject/node_modules/parley/lib/private/Deferred.js:1151:14)
    at proceedToInterceptsAndChecks (/home/ubuntu/dev/testproject/node_modules/parley/lib/private/Deferred.js:909:12)
    at proceedToAfterExecSpinlocks (/home/ubuntu/dev/testproject/node_modules/parley/lib/private/Deferred.js:841:10)
    at /home/ubuntu/dev/testproject/node_modules/parley/lib/private/Deferred.js:303:7
    at /home/ubuntu/dev/testproject/node_modules/machine/lib/private/help-build-machine.js:954:24
    at Function.handlerCbs.success (/home/ubuntu/dev/testproject/node_modules/machine/lib/private/help-build-machine.js:814:26)
    at Query.query [as _callback] (/home/ubuntu/dev/testproject/node_modules/machinepack-mysql/lib/send-native-query.js:320:20)
    at Query.Sequence.end (/home/ubuntu/dev/testproject/node_modules/machinepack-mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:88:24)
    at Query._handleFinalResultPacket (/home/ubuntu/dev/testproject/node_modules/machinepack-mysql/node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
    at Query.OkPacket (/home/ubuntu/dev/testproject/node_modules/machinepack-mysql/node_modules/mysql/lib/protocol/sequences/Query.js:72:10)
    at Protocol._parsePacket (/home/ubuntu/dev/testproject/node_modules/machinepack-mysql/node_modules/mysql/lib/protocol/Protocol.js:279:23)
    at Parser.write (/home/ubuntu/dev/testproject/node_modules/machinepack-mysql/node_modules/mysql/lib/protocol/Parser.js:76:12)
    at Protocol.write (/home/ubuntu/dev/testproject/node_modules/machinepack-mysql/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/home/ubuntu/dev/testproject/node_modules/machinepack-mysql/node_modules/mysql/lib/Connection.js:103:28)

[?] For more help, visit https://sailsjs.com/support


error: Failed to lift app: Error: Sails is taking too long to load.


Troubleshooting tips:
-• Were you still reading/responding to an interactive prompt?
(Whoops, sorry! Please lift again and try to respond a bit more quickly.)

-• Do you have a lot of stuff in assets/? Grunt might still be running.
(Try increasing the hook timeout. Currently it is 40000.
e.g. sails lift --hookTimeout=80000)

-• Is pubsub a custom or 3rd party hook?
(If initialize() is using a callback, make sure it's being called.)


at Timeout.tooLong [as _onTimeout] (/home/ubuntu/dev/testproject/node_modules/sails/lib/app/private/loadHooks.js:191:21)
at listOnTimeout (timers.js:324:15)
at processTimers (timers.js:268:5)

``

@Enteee
Copy link

Enteee commented May 21, 2019

I got a similar error today and I think this is down to the fact that this hook expects sails to add the global _, like here. And as far as I know sails disabled the global _ by default with version 1.x something, something, dark side..

So a quick fix for this problem was for me:

  1. install lodash as dependency
  2. add _: require('lodash'), to config/globals.js

I think this module should declare a dependency to lodash and require it itself. Relying on those ugly globals does not seem to be the way forward. This should be simple to patch.. Give me a few.

@Enteee
Copy link

Enteee commented May 21, 2019

see pr: #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants