Sails: Could not tear down the ORM hook. Error details: Error: Consistency violation: Attempting to tear down a datastore (`default`) which is not currently registered with this adapter... :: Regression with [email protected]

Created on 12 Apr 2017  Â·  12Comments  Â·  Source: balderdashy/sails

Sails version: 1.0.0-33
Node version: 7.5.0
NPM version: 4.4.4
Operating system: macOS Sierra 10.12.4



Hello, when I start my sails app, I'm experiencing this error with [email protected]:

```/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run start-dev

NODE_ENV=development node $NODE_DEBUG_OPTION app.js

info: ·• Auto-migrating... (alter)
info: Hold tight, this could take a moment.
error: A hook (orm) failed to load!
error: Could not tear down the ORM hook. Error details: Error: Consistency violation: Attempting to tear down a datastore (default) which is not currently registered with this adapter. This is usually due to a race condition in userland code (e.g. attempting to tear down the same ORM instance more than once), or it could be due to a bug in this adapter. (If you get stumped, reach out at http://sailsjs.com/support.)
at Object.teardown (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/sails-mongo/lib/index.js:346:19)
at /Users/eliottvincent/Development/tmp-family-abcde/node_modules/waterline/lib/waterline.js:327:27
at /Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:3047:20
at eachOfArrayLike (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:1002:13)
at eachOf (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:1052:9)
at Object.eachLimit (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:3111:7)
at Object.teardown (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/waterline/lib/waterline.js:311:11)
at Hook.teardown (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/sails-hook-orm/index.js:246:30)
at Sails.wrapper (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/@sailshq/lodash/lib/index.js:3250:19)
at Object.onceWrapper (events.js:291:19)
at emitNone (events.js:86:13)
at Sails.emit (events.js:186:7)
at Sails.emitter.emit (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/sails/lib/app/private/after.js:56:26)
at /Users/eliottvincent/Development/tmp-family-abcde/node_modules/sails/lib/app/lower.js:67:11
at beforeShutdown (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/sails/lib/app/lower.js:45:12)
at Sails.lower (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/sails/lib/app/lower.js:49:3)
error: Failed to lift app: Error: The model token has attributes with non-unique column names. Each attribute in the model must have a unique column name.
at parseCollections (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/waterline-schema/lib/waterline-schema/checks.js:44:13)
at /Users/eliottvincent/Development/tmp-family-abcde/node_modules/@sailshq/lodash/lib/index.js:3228:15
at baseForOwn (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/@sailshq/lodash/lib/index.js:2199:14)
at /Users/eliottvincent/Development/tmp-family-abcde/node_modules/@sailshq/lodash/lib/index.js:3198:18
at Function. (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/@sailshq/lodash/lib/index.js:3501:13)
at sanityChecks (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/waterline-schema/lib/waterline-schema/checks.js:15:5)
at new WaterlineSchema (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/waterline-schema/lib/waterline-schema.js:48:3)
at Object.initialize (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/waterline/lib/waterline.js:155:26)
at buildOntologyAndRunAutoMigrations (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/sails-hook-orm/lib/build-ontology-and-run-auto-migrations.js:55:7)
at async.auto._buildOntology (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/sails-hook-orm/lib/initialize.js:436:7)
at runTask (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:1660:17)
at /Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:1602:17
at processQueue (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:1612:17)
at taskComplete (/Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:1630:13)
at /Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:1653:21
at /Users/eliottvincent/Development/tmp-family-abcde/node_modules/async/dist/async.js:339:31
error: (You are seeing this error message because no callback was provided to .lift().)

Process finished with exit code 0
```

The first error is the most obscure for me. I will create a separated issue for the second one.

needs better error message v1.x

Most helpful comment

Yo tenia el password de la base de datos asi: "90a9d8$0s/@" y lo cambie solo por letras y numeros y ya jalo.

All 12 comments

@eliottvct Thanks for posting, we'll take a look as soon as possible.


For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here.

This is my package.json:

{
    "name": "somename",
    "private": true,
    "version": "0.0.1",
    "description": "somedescription",
    "keywords": [somekeywords],
    "dependencies": {
        "sails": "^1.0.0-33",
        "grunt": "1.0.1",
        "sails-hook-orm": "^2.0.0-0",
        "sails-hook-sockets": "^1.0.1",
        "sails-hook-grunt": "^1.0.4",
        "lodash": "3.10.1",
        "async": "2.0.1",
        "mongoose": "^4.9.0",
        "request": "^2.75.0",
        "sails-mongo": "^1.0.0-7"
    },
    "devDependencies": {
        "eslint": "3.19.0",
        "jshint": "2.9.4"
    },
    "scripts": {
        "start": "NODE_ENV=production node app.js",
        "start-dev": " NODE_ENV=development node $NODE_DEBUG_OPTION app.js",
        "test": "npm run lint && npm run custom-tests && echo 'Done.'",
        "lint": "npm run eslint && npm run jshint",
        "eslint": "node ./node_modules/eslint/bin/eslint . --max-warnings=100 && echo '✅  ESLINT validated'",
        "jshint": "node ./node_modules/jshint/bin/jshint api/. && echo '✅  JSHINT validated'",
        "custom-tests": "echo \"(No other custom tests yet.)\" && echo",
        "debug": "node debug app.js"
    },
    "main": "app.js",
    "repository": {
        "type": "git",
        "url": "someurl"
    },
    "author": "Eliott VINCENT <[email protected]>",
    "license": "MIT"
}

And my config/datastores.js :

```/**

  • Datastores
  • (sails.config.datastores)
    *
  • A set of datastore configurations which tell Sails where to fetch or save
  • data when you execute built-in model methods like .find() and .create().
    *
  • > This file is mainly useful for configuring your development database,
  • > as well as any additional one-off databases used by individual models.
  • > Ready to go live? Head towards config/env/production.js.
    *
  • For more information on configuring datastores, check out:
  • https://sailsjs.com/config/datastores
    */

module.exports.datastores = {

/*************************

  • *
  • Your app's default datastore. *
  • *
  • Sails apps read and write to local disk by default, using a built-in *
  • database adapter called sails-disk. This feature is purely for *
  • convenience during development; since sails-disk is not designed for *
  • use in a production environment. *
  • *
  • To use a different db _in development_, follow the directions below. *
  • Otherwise, just leave the default datastore as-is, with no adapter. *
  • *
  • (For production configuration, see config/env/production.js.) *
  • *
    *************************/

default: {

/***************************************************************************
*                                                                          *
* Want to use a different database during development?                     *
*                                                                          *
* 1. Choose an adapter:                                                    *
*    https://sailsjs.com/plugins/databases                                  *
*                                                                          *
* 2. Install it as a dependency of your Sails app.                         *
*    (For example:  npm install sails-mysql --save)                        *
*                                                                          *
* 3. Then pass it in, along with a connection URL.                         *
*    (See https://sailsjs.com/config/datastores for help.)                  *
*                                                                          *
***************************************************************************/
adapter: 'sails-mongo',
url: 'mongodb://127.0.0.1:27017/family-db-local',

},

};
```

@eliottvct thanks! Looking into it

No problem, let me know if you need extra information

Hey @eliottvct, would you post your Token module? (or feel free to do it in the separate issue-- that sounds like a good idea)

The first error is definitely confusing, but fortunately can safely be ignored. It's just being displayed because Sails is trying to terminate the ORM before it ever successfully started up. This is something we can improve upon (basically we just need to use a flag in sails-hook-orm). I'll flag this issue as orange in regards to that.

@mikermcneil Thanks for your fast support! I opened issue 4072 with Token.js model

@eliottvct,@sailsbot,@mikermcneil: Hello, I'm a repo bot-- nice to meet you!

It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).

If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.

Thanks so much for your help!

please im facing same problem, how can i solve this

Getting same issue when deploy on the server, Can anyone help me please.
I am using sails-mysql adapter

error: A hook (orm) failed to load!
error: Could not tear down the ORM hook. Error details: Error: Invalid data store identity. No data store exist with that identity.
at Object.teardown (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails-mysql/helpers/teardown.js:60:26)
at wrapper (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/@sailshq/lodash/lib/index.js:3275:19)
at Deferred._handleExec (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/machine/lib/private/help-build-machine.js:1076:19)
at Deferred.exec (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/parley/lib/private/Deferred.js:286:10)
at Deferred.switch (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/machine/lib/private/help-build-machine.js:1469:16)
at teardownDatastore (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails-mysql/lib/adapter.js:94:18)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:3047:20
at replenish (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:884:21)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:888:13
at eachLimit$1 (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:3136:26)
at Object. (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:920:20)
at Object.teardown (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails-mysql/lib/adapter.js:89:13)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/waterline/lib/waterline.js:758:27
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:3047:20
at eachOfArrayLike (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1002:13)
at eachOf (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1052:9)
at Object.eachLimit (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:3111:7)
at Object.teardown (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/waterline/lib/waterline.js:742:11)
at Hook.teardown (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails-hook-orm/index.js:246:30)
at Sails.wrapper (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/@sailshq/lodash/lib/index.js:3275:19)
at Object.onceWrapper (events.js:322:30)
at emitNone (events.js:115:13)
at Sails.emit (events.js:218:7)
at Sails.emitter.emit (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails/lib/app/private/after.js:56:26)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails/lib/app/lower.js:67:11
at beforeShutdown (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails/lib/app/lower.js:45:12)
at Sails.lower (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails/lib/app/lower.js:49:3)
at Sails.wrapper [as lower] (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/@sailshq/lodash/lib/index.js:3275:19)
error:
error: Exception: registerDataStore failed ("badConfiguration"). The configuration was invalid. (Also got an additional error -- see .raw).
at Object.registerDatastore (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails-mysql/lib/adapter.js:54:17)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/waterline/lib/waterline.js:714:27
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:3047:20
at eachOfArrayLike (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1002:13)
at eachOf (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1052:9)
at Object.eachLimit (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:3111:7)
at Object.initialize (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/waterline/lib/waterline.js:650:11)
at buildOntologyAndRunAutoMigrations (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails-hook-orm/lib/build-ontology-and-run-auto-migrations.js:55:7)
at async.auto._buildOntology (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails-hook-orm/lib/initialize.js:456:7)
at runTask (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1660:17)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1602:17
at processQueue (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1612:17)
at taskComplete (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1630:13)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1653:21
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:339:31
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:847:20
at async.auto._checkAdapterCompatibility (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/sails-hook-orm/lib/initialize.js:428:14)
at runTask (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1660:17)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1602:17
at processQueue (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1612:17)
at taskComplete (/var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1630:13)
at /var/www/projects/abang/abang/fernline-api-fresh/node_modules/async/dist/async.js:1653:21

Yo tenia el password de la base de datos asi: "90a9d8$0s/@" y lo cambie solo por letras y numeros y ya jalo.

I faced the same issue with MySQL adapter and datastore config. It got fixed when I used a plain alphanumeric mysql password without special characters. FYI my earlier password was "K!a(HK$%{K". Thanks for https://github.com/balderdashy/sails/issues/4069#issuecomment-495046633 for the tip!

Was this page helpful?
0 / 5 - 0 ratings