snowyu/loopback-component-auto-migrate.js

loopback-component-auto-migrate-done is not resolved

Closed this issue · 4 comments

In my setup this promise is never resolved:

./server/component-config.json:

{
  "loopback-component-auto-migrate": {
    "enabled": true,
    "raiseError": true,
    "migration": "auto-update"
  }
}

./server/component-config.testing.json

{
  "loopback-component-auto-migrate": {
    "enabled": true,
    "raiseError": false,
    "migration": "auto-migrate"
  }
}

./server/boot/file1.js

module.exports = function (app) {
    app.get('loopback-component-auto-migrate-done')
      .then((result) => {
        console.log('migration done (file1) - this never shows up in logs');
      });
}

./server/boot/file1.js

module.exports = function (app) {
    app.get('loopback-component-auto-migrate-done')
      .then((result) => {
        console.log('migration done (file2) - this never shows up in logs');
      });
}

command:
export DEBUG=loopback:component:autoMigrate:*; export NODE_ENV=testing; npm start

loopback debug (one line, nothing else):

  loopback:component:autoMigrate:main initializing component +0ms

When there is no database or it's empty, collections are created correctly, but that promise is never resolved.

Edit: I've found that it's happening only when this module is also enabled and configured:
https://github.com/kolach/loopback-component-cloudinary

Does the auto-migrate task executed or not? If not , which means the loopback can not process promise for some reason or the process be stopped via other internal error?

Do you skip these loopback-component-cloudinary model?

Or just set only one model to test migration.

I skip the loopback-component-cloudinary model and it worked, that's why I introduced this PR
Now it's all fine, you can close this thread, thank you