A hook (`orm`) failed to load! for Mongodb - mongodb

Anyone can help??
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 (D:\gcloud\test01-2\node_modules\sails-mongo\lib\index.js:390:19)
at D:\gcloud\test01-2\node_modules\waterline\lib\waterline.js:758:27
at D:\gcloud\test01-2\node_modules\async\dist\async.js:3047:20
at eachOfArrayLike (D:\gcloud\test01-2\node_modules\async\dist\async.js:1002:13) at eachOf (D:\gcloud\test01-2\node_modules\async\dist\async.js:1052:9)
at Object.eachLimit (D:\gcloud\test01-2\node_modules\async\dist\async.js:3111:7) at Object.teardown (D:\gcloud\test01-2\node_modules\waterline\lib\waterline.js:742:11)
at Hook.teardown (D:\gcloud\test01-2\node_modules\sails-hook-orm\index.js:246:30)
at Sails.wrapper (D:\gcloud\test01-2\node_modules\#sailshq\lodash\lib\index.js:3275:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Sails.emit (events.js:208:7)
at Sails.emitter.emit (D:\gcloud\test01-2\node_modules\sails\lib\app\private\after.js:56:26)
at D:\gcloud\test01-2\node_modules\sails\lib\app\lower.js:67:11
at beforeShutdown (D:\gcloud\test01-2\node_modules\sails\lib\app\lower.js:45:12) at Sails.lower (D:\gcloud\test01-2\node_modules\sails\lib\app\lower.js:49:3)
at Sails.wrapper [as lower] (D:\gcloud\test01-2\node_modules\#sailshq\lodash\lib\index.js:3275:19)
at whenSailsIsReady (D:\gcloud\test01-2\node_modules\sails\lib\app\lift.js:68:13)
at D:\gcloud\test01-2\node_modules\sails\node_modules\async\dist\async.js:3861:9 at D:\gcloud\test01-2\node_modules\sails\node_modules\async\dist\async.js:421:16 at iterateeCallback (D:\gcloud\test01-2\node_modules\sails\node_modules\async\dist\async.js:924:17)
at D:\gcloud\test01-2\node_modules\sails\node_modules\async\dist\async.js:906:16error:
error: Error: Consistency violation: Unexpected error creating db connection manager:
```
ImplementationError: Internal error occurred while running createManager. Got non-Error: { MongoError: connection 0 to cluster0-shard-00-00-cqwe8.mongodb.net:27017 closed
at Function.MongoError.create (D:\gcloud\test01-2\node_modules\mongodb-core\lib\error.js:29:11)
at Socket. (D:\gcloud\test01-2\node_modules\mongodb-core\lib\connection\connection.js:202:22)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at TCP._handle.close [as _onclose] (net.js:557:12)
name: 'MongoError',
message: 'connection 0 to cluster0-shard-00-00-cqwe8.mongodb.net:27017 closed' }
If you are the maintainer of "createManager", then you can change its implementation to solve the problem (Most of the time, the solution is just to throw an actual Error instance instead. Alternatively, if the goal was to indicate a particular exception, you could throw any of the special, reserved "exit signals"-- e.g. the code name of any of your defined exits besides "error" or "success"). Otherwise, please file a bug report with the maintainer, or fork your own copy and fix that.
[?] See https://sailsjs.com/support for help.
at Object.registerDatastore (D:\gcloud\test01-2\node_modules\sails-mongo\lib\index.js:263:18)
at D:\gcloud\test01-2\node_modules\waterline\lib\waterline.js:714:27
at D:\gcloud\test01-2\node_modules\async\dist\async.js:3047:20
at eachOfArrayLike (D:\gcloud\test01-2\node_modules\async\dist\async.js:1002:13) at eachOf (D:\gcloud\test01-2\node_modules\async\dist\async.js:1052:9)
at Object.eachLimit (D:\gcloud\test01-2\node_modules\async\dist\async.js:3111:7) at Object.initialize (D:\gcloud\test01-2\node_modules\waterline\lib\waterline.js:650:11)
at buildOntologyAndRunAutoMigrations (D:\gcloud\test01-2\node_modules\sails-hook-orm\lib\build-ontology-and-run-auto-migrations.js:55:7)
at async.auto._buildOntology (D:\gcloud\test01-2\node_modules\sails-hook-orm\lib\initialize.js:456:7)
at runTask (D:\gcloud\test01-2\node_modules\async\dist\async.js:1660:17)
at D:\gcloud\test01-2\node_modules\async\dist\async.js:1602:17
at processQueue (D:\gcloud\test01-2\node_modules\async\dist\async.js:1612:17)
at taskComplete (D:\gcloud\test01-2\node_modules\async\dist\async.js:1630:13)
at D:\gcloud\test01-2\node_modules\async\dist\async.js:1653:21
at D:\gcloud\test01-2\node_modules\async\dist\async.js:339:31
at D:\gcloud\test01-2\node_modules\async\dist\async.js:847:20
at async.auto._checkAdapterCompatibility (D:\gcloud\test01-2\node_modules\sails-hook-orm\lib\initialize.js:428:14)
at runTask (D:\gcloud\test01-2\node_modules\async\dist\async.js:1660:17)
at D:\gcloud\test01-2\node_modules\async\dist\async.js:1602:17
at processQueue (D:\gcloud\test01-2\node_modules\async\dist\async.js:1612:17)
at taskComplete (D:\gcloud\test01-2\node_modules\async\dist\async.js:1630:13)
at D:\gcloud\test01-2\node_modules\async\dist\async.js:1653:21
```
at Object.error (D:\gcloud\test01-2\node_modules\sails-mongo\lib\index.js:268:21)
at D:\gcloud\test01-2\node_modules\machine\lib\private\help-build-machine.js:1514:39
at proceedToFinalAfterExecLC (D:\gcloud\test01-2\node_modules\parley\lib\private\Deferred.js:1149:14)
at proceedToInterceptsAndChecks (D:\gcloud\test01-2\node_modules\parley\lib\private\Deferred.js:909:12)
at proceedToAfterExecSpinlocks (D:\gcloud\test01-2\node_modules\parley\lib\private\Deferred.js:841:10)
at D:\gcloud\test01-2\node_modules\parley\lib\private\Deferred.js:303:7
at D:\gcloud\test01-2\node_modules\machine\lib\private\help-build-machine.js:952:35
at Function.handlerCbs.error (D:\gcloud\test01-2\node_modules\machine\lib\private\help-build-machine.js:742:26)
at connectCb (D:\gcloud\test01-2\node_modules\sails-mongo\lib\private\machines\create-manager.js:130:22)
at connectCallback (D:\gcloud\test01-2\node_modules\mongodb\lib\mongo_client.js:428:5)
at D:\gcloud\test01-2\node_modules\mongodb\lib\mongo_client.js:335:11
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)

You should set config.datastore.default.adapter: 'sails-mongo'. Moreover, if you modified a model while there was data in the db you should drop it.

Related

Can not get environment variables "ELECTRON_GET_USE_PROXY" in integrated terminal of vscode. Is anyone else has met this problem?

I am using electron-quick-start project to learn electron, and when I open this project in vscode and execute yarn install, some exception has been throwed out:
Exit code: 1
Command: node install.js
Arguments:
Directory: C:\Users\user_home\Downloads\electron-quick-start-master\node_modules\electron
Output:
RequestError: getaddrinfo ENOTFOUND npm.taobao.org
at ClientRequest.<anonymous> (C:\Users\user_home\Downloads\electron-quick-start-master\node_modules\got\source\request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:418:26)
at ClientRequest.emit (events.js:323:22)
at ClientRequest.origin.emit (C:\Users\user_home\Downloads\electron-quick-start-master\node_modules\#szmarczak\http-timer\source\index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:311:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
I have set the system environment variables following electron's official proxy setting guide:
ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
ELECTRON_GET_USE_PROXY=true
by debuging the node_modules/electron/install.js, I found that the process.env.ELECTRON_GET_USE_PROXY is not value I have set but undefined. but when I debug this script in powershell opened from the explorer, process.env.ELECTRON_GET_USE_PROXY print out the right value I have set.

IBM Cloud App ID' s custom identity flow:InternalOAuthError occurs

I use IBM Cloud App ID' and I want to use LinkedIn as a provider.
However, "InternalOAuthError" occurs at the time of app approving.
There is a sample on the IBM Cloud blog.
Sign In Your App Users With Any Identity Provider Using App ID
I tried the sample app along this flow. Login to LinkedIn seems to have succeeded, but the following error occurred when app was approved.
InternalOAuthError: failed to fetch user profile
at _oauth2.get (C:\xxx\AppIdCustomIdentity\node_modules\passport-linkedin-oauth2\lib\oauth2.js:70:23)
at passBackControl (C:\xxx\AppIdCustomIdentity\node_modules\oauth\lib\oauth2.js:132:9)
at IncomingMessage.<anonymous> (C:\xxx\AppIdCustomIdentity\node_modules\oauth\lib\oauth2.js:157:7)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Please help!!
When I tried this post,"InternalOAuthError" no longer occurs.
But another error has occurred.
Error: Failed to obtain tokens
at Request.request [as _callback] (C:\xxx\AppIdCustomIdentity\node_modules\ibmcloud-appid\lib\token-manager\token-manager.js:118:13)
at Request.self.callback (C:\xxx\AppIdCustomIdentity\node_modules\request\request.js:185:22)
at Request.emit (events.js:182:13)
at Request.<anonymous> (C:\xxx\AppIdCustomIdentity\node_modules\request\request.js:1161:10)
at Request.emit (events.js:182:13)
at IncomingMessage.<anonymous> (C:\xxx\AppIdCustomIdentity\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:273:13)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
As suggested in this post (https://stackoverflow.com/a/56329029/10422503), looks like the passport-linkedin-oauth2 library has not been updated for the LinkedIn 2.0 APIs. Try using the fork suggested there
Looking at the stack trace it looks like the exception is coming from passport-linkedin-oauth2 module.
at _oauth2.get (C:\xxx\AppIdCustomIdentity\node_modules\passport-linkedin-oauth2\lib\oauth2.js:70:23)
Googling for InternalOAuthError: failed to fetch user profile +linkedin gives a few options you might want to try.

truffle init Error making request. Please check the format of the requested resource

How can I resolve this for truffle#4.0.1?
I am running 'truffle init' in Windows PowerShell as an Admin and I am receiving this error. If I try to go to the url in the browser it gives me I see an ERR_CONNECTION_RESET page.
PS C:\Users\UserName\desktop\Demo> truffle init
Downloading...
Error: Error making request. Please check the format of the requested resource: https://raw.githubusercontent.com/truffle-box/bare-box/master/truffle.js
at Request._callback (C:\Users\zswann\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:311386:23)
at self.callback (C:\Users\zswann\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:283165:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestError (C:\Users\zswann\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:283857:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at TLSSocket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
I got the same issue and figured out that my browser blocking the URL: https://raw.githubusercontent.com
Once my admin unblock the URL and it's working fine.

ionic2: Uploading source images to prepare for transformations failed?

I'm using ionic2, I want to set custom splash image so I set splash.png in ../myproject/resources/splash.png and then i run this command: ionic cordova resources --splash but I got this error:
Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1140:19)
at Object.onceWrapper (events.js:314:30)
at emitNone (events.js:110:20)
at TLSSocket.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
what should i do?
the problem was the internet connection speed is low

SailsJs error with grabConnection(conn)

Can someone help me with this SailsJs error
Running "less:dev" (less) task
verbose: Lowering sails...
verbose: Sent kill signal to child process (26729)...
../staging.platform/node_modules/sails-disk/lib/adapter.js:80
grabConnection(conn).dropCollection(coll, relations, cb);
^
TypeError: Cannot read property 'dropCollection' of undefined
at Object.drop (../staging.platform/node_modules/sails-disk/lib/adapter.js:80:27)
at module.exports.drop (../staging.platform/node_modules/waterline/lib/waterline/adapter/ddl/index.js:110:13)
at afterAsyncEach (../staging.platform/node_modules/waterline/lib/waterline/adapter/sync/strategies/alter.js:190:14)
at ../staging.platform/node_modules/async/lib/async.js:52:16
at Object.async.forEachOf.async.eachOf (../staging.platform/node_modules/async/lib/async.js:236:30)
at Object.async.forEach.async.each (../staging.platform/node_modules/async/lib/async.js:209:22)
at ../staging.platform/node_modules/waterline/lib/waterline/adapter/sync/strategies/alter.js:134:13
at wrapper (../staging.platform/node_modules/waterline/node_modules/lodash/index.js:3592:19)
at applyInOriginalCtx (../staging.platform/node_modules/waterline/lib/waterline/utils/normalize.js:421:80)
at wrappedCallback (../staging.platform/node_modules/waterline/lib/waterline/utils/normalize.js:324:18)
at success (../staging.platform/node_modules/waterline/node_modules/switchback/lib/normalize.js:33:31)
at _switch (../staging.platform/node_modules/waterline/node_modules/switchback/lib/factory.js:58:28)
at ../staging.platform/node_modules/sails-disk/lib/adapter.js:88:19
at Timeout._onTimeout (../staging.platform/node_modules/sails-disk/lib/adapter.js:179:10)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
The problem I am having is, this error popped up without real cause. On my local machine my Sails App works - however, on my sandbox remote server, I just started getting the error...
I am completely at a lost...