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

Failed to reload ORM hook #60

Open
nehalist opened this issue Apr 9, 2016 · 30 comments
Open

Failed to reload ORM hook #60

nehalist opened this issue Apr 9, 2016 · 30 comments

Comments

@nehalist
Copy link

nehalist commented Apr 9, 2016

error: Failed to reload ORM hook. Details: Error: Failed to reinitialize ORM because the initialize() method of the ORM hook returned an error.
Details:
Error: Consistency violation: Instantiated Waterline model already has a datastore property.

Packages:

    "bcryptjs": "^2.3.0",
    "ejs": "2.3.4",
    "grunt": "0.4.5",
    "grunt-contrib-clean": "0.6.0",
    "grunt-contrib-coffee": "0.13.0",
    "grunt-contrib-concat": "0.5.1",
    "grunt-contrib-copy": "0.5.0",
    "grunt-contrib-cssmin": "0.9.0",
    "grunt-contrib-jst": "0.6.0",
    "grunt-contrib-less": "1.1.0",
    "grunt-contrib-sass": "^1.0.0",
    "grunt-contrib-uglify": "0.7.0",
    "grunt-contrib-watch": "0.5.3",
    "grunt-sails-linker": "~0.10.1",
    "grunt-sync": "0.2.4",
    "include-all": "~0.1.6",
    "marlinspike": "^1.0.0",
    "passport": "^0.3.2",
    "passport-local": "^1.0.0",
    "rc": "1.0.1",
    "sails": "~0.12.3",
    "sails-auth": "^2.1.3",
    "sails-disk": "~0.10.9",
    "sails-hook-autoreload": "^0.13.1",
    "sails-permissions": "^2.2.0",
    "validator": "^5.2.0"

Sails version v0.12.3.

Guess it has something to do with sails permissions, sails auth or marlinspike (everything worked fine before they were installed).

@pekpon
Copy link

pekpon commented May 2, 2016

Same problem here. Any solution? Thanks!

@sgress454
Copy link
Owner

@nehalist @pekpon Could one of of you create a repo that demonstrates the problem? I think that'd be the easiest way to see what's going on.

e.g.:

sails new sails-hook-autoreload-issue-60
cd sails-hook-autoreload-issue-60
npm install sails-hook-autoreload
# Now make whichever are the simplest/quickest changes which reproduce the issue,
# and when you for sure have the issue isolated, run:
git init
hub create  # or use the GitHub UI to create the repo and `git remote add` it manually
git add .
git commit -am 'Reproduces https://github.com/sgress454/sails-hook-autoreload/issues/60'
git push -u origin master
hub browse # or open the repo in your browser manually
# Then copy the URL of the new repo and paste it as a comment on this issue.
# We'll check it out, and since this way we'll be able to experience the problem
# ourselves, we should have no problem getting to the bottom of it.

Thanks man!

@pekpon
Copy link

pekpon commented May 5, 2016

@sgress454 thanks for your reply!

I finally make it work reinstalling sails-hook and sails-mongo

Thanks!

@nehalist
Copy link
Author

nehalist commented May 5, 2016

@sgress454 here you go; https://github.com/nehalist/sails-hook-autoreload-issue-60

Fresh install. Problem seems to have nothing to do with sails-permissions, but with sails-auth. After installing sails-auth autoreload fails with the error mentioned in the entry post.

e/ Wrong mention, whoops...

@sgress454
Copy link
Owner

Thanks @pekpon. It's very possible that these two hooks are just incompatible, but I will take a look.

@RyanParsley
Copy link

I do not have sails-auth or sails-permissions installed and I saw the same error. I had the swagger plugin that depended on marlinspike. Once I removed that plugin, my problems went away.

@miraage
Copy link

miraage commented Jul 19, 2016

Problem still exists.

@slavafomin
Copy link

I have this problem also. Looks like this plugin makes development database extremely unstable, sometimes some rows are just dropped, sometimes the entire passport database table is dropped and it's all when migrate: safe config option is set. I'm removing this module for now.

@giovannibenussi
Copy link

Same problem

@fourthdimension
Copy link

Same here.

@liratanak
Copy link

I also got this error.

Failed to reload ORM hook.  Details: Error: Failed to reinitialize ORM because the `initialize()` method of the ORM hook returned an error.  
Details:
Error: Consistency violation: Instantiated Waterline model already has a `datastore` property.
...

@fsin
Copy link

fsin commented Sep 6, 2016

Sehr geehrte Damen und Herren,

ich werde ab 07.09.2015 wieder im Büro sein,
Ihre Nachricht wird nicht automatisch weitergeleitet. Ich werde Ihre Nachricht nach meiner Rückkehr beantworten.

Bitte kontaktieren Sie in dringenden Fällen Herrn Dr. Stefan Landshamer ([email protected]).

Mit freundlichen Grüßen,
Florian Schindler

pavelkast pushed a commit to pavelkast/sails-hook-autoreload that referenced this issue Sep 28, 2016
@ghost
Copy link

ghost commented Oct 20, 2016

I had this problem when updating my orm hook connection name, after the model has already been setted up.
Setting the new connection name in
config/env/development.js , config/models.js and config/connection.js fixed that for me

@clayrisser
Copy link

I'm experiencing this same problem.

@JonathanItakpe
Copy link

JonathanItakpe commented Nov 12, 2016

create an autoreload.js file in you config folder with the following content:
module.exports.autoreload = { active: true, overrideMigrateSetting: false, usePolling: false, dirs: [ "api/models", "api/controllers", "api/services", "config/locales" ], ignored: [ // Ignore all files with .ts extension "**.ts" ] };

Make sure you set migrate to safe in models.js

Fixed for me.

@clayrisser
Copy link

I did both of those things, and it didn't work.

@antwal
Copy link

antwal commented Jan 9, 2017

Hi,

i have same problem when try edit config/locales/; i have tryed with autoreload.js and with watch.js but i receive always same error:

error: Failed to reload ORM hook. Details: Error: Failed to reinitialize ORM because the initialize() method of the ORM hook returned an error.
Details: Error: Consistency violation: Instantiated Waterline model already has a datastore property.

Thanks.

@murbanowicz
Copy link

The same issue here. Sails lifting up properly, but reload not working

@inicio
Copy link

inicio commented Feb 9, 2017

Ditto. Same issue.

@arjun-kava
Copy link

same issue

@sgress454
Copy link
Owner

Hi all, sorry for letting this one go for so long. While I see that this issue is affecting a number of people, just posting "same issue" isn't really helpful since the only repros I've seen so far involve the installation of other plugins that just might not be compatible with sails-hook-autoreload.

I try to make this clear in the README, but this tool is intended for rapid-prototyping of early-stage apps, where you're still building up your model schema and basic functionality, and don't want to have to keep lowering and re-lifting Sails every time you tweak a model or controller. Once your app reaches the level of sophistication where you've got other third-party hooks involved (especially ones that operate on models), there's no guarantees, and you're probably going to need a solution like forever which cold-boots your app every time a file is changed.

If someone can post a repo that shows this issue using just Sails and one of the core adapters (e.g. sails-postgresql or sails-mongo), and not involving another plugin, I'm happy to troubleshoot the issue!

@HaiderMalik12
Copy link

Same issue here

@HaiderMalik12
Copy link

I always get this error.
error: A hook (orm) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error

@murbanowicz
Copy link

murbanowicz commented Mar 8, 2017 via email

@HaiderMalik12
Copy link

Why sails team did you fix this issue ?

@sgress454
Copy link
Owner

@HaiderMalik12 @murbanowicz please read my comment above, and provide an actual repo that reproduces the problem without having an incompatible package installed so we can troubleshoot. I've provided a sample list of incompatible packages in the README.

@Fr33maan
Copy link
Collaborator

Fr33maan commented Aug 31, 2017

I had this issue and successfully fixed it. It was about hooks in .sailsrc if my memory is good. I've got a repo which implements sails/sails-hook-autoreload/sails-webpack with react/redux, hot reloading, rebundling and so on.
It's my starter pack for every sails project I have to do. The config is minimal, you all should find the way to correct this issue by checking your repo against mine.

The repo is called sails-webpack-react-2. The version 1 contains a similar error.

@clayrisser
Copy link

I just ended up using nodemod. It's super easy and requires no setup.

https://nodemon.io/

@Fr33maan
Copy link
Collaborator

Fr33maan commented Sep 6, 2017

Well, shutdown and restarting the server takes up to 3/4 seconds in my case (webpack because of React). The hook is better.
I've got 2 watchers, one is sails-hook-autoreload which reload the sails app and the other is the webpack watcher wich rebundle my assets and reload the browser.

@umeshp7
Copy link

umeshp7 commented Oct 24, 2018

Failed to reinitialize ORM because the initialize() method of the ORM hook returned an error.
Details:
userError: The attribute flow_screens on the flow_screens__screen_flows model is an association but also specifies a type property. This is not needed and will be automatically determined.

I am facing this issue. I haven't specified any type property for the association that I have created.

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

No branches or pull requests