-
-
Notifications
You must be signed in to change notification settings - Fork 360
Warning: a promise was created in a handler but was not returned from it #545
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
Comments
This is most probably an user error and not releated to db-migrate. See https://github.com/petkaantonov/bluebird/blob/master/docs/docs/warning-explanations.md#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it To help you identify what exactly you're doing wrong you would need to show us the migration that you've written that is failing here. |
Best provide a gist or example project, to help on this topic. |
Sure. Thanks for the quick response. Basically we have a number of one off migrations and a few async series (if I were a betting man I'd bet the series could use some work) It is also interesting to note that even removing all migrations but 1 simple migration still results in the warning. Please take a look at my at the examples below. Let me know if there is anything more I can provide you.
async.series example
thanks for your help. |
Actually impossible to reproducce, even with your examples, I do not run into any trouble executing either of those. However this style is really really old though. The second one would look like this today exports.up = async function (db) {
await db.addForeignKey(
NAME,
'users',
USERS_KEY,
{
_id: 'id'
},
{
onDelete: 'CASCADE',
onUpdate: 'RESTRICT'
}
);
return db.addForeignKey(
NAME,
'user_agreements',
AGREEMENTS,
{
agreement_id: 'id'
},
{
onDelete: 'CASCADE',
onUpdate: 'RESTRICT'
}
);
};
exports.down = async function (db) {
await db.removeForeignKey(NAME, USERS_KEY);
return db.removeForeignKey(NAME, AGREEMENTS);
}; As you're still on node 6 and don't have natively async/await you can fall back to: exports.up = function (db) {
return db
.addForeignKey(
NAME,
'users',
USERS_KEY,
{
_id: 'id'
},
{
onDelete: 'CASCADE',
onUpdate: 'RESTRICT'
}
)
.then(() =>
db.addForeignKey(
NAME,
'user_agreements',
AGREEMENTS,
{
agreement_id: 'id'
},
{
onDelete: 'CASCADE',
onUpdate: 'RESTRICT'
}
)
);
};
exports.down = function (db) {
return db
.removeForeignKey(NAME, USERS_KEY)
.then(() => db.removeForeignKey(NAME, AGREEMENTS));
}; |
Also take a look at what the create command creates for you. The |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm submitting a...
Current behavior
When running any migration (up or down) the following error presents itself:
Expected behavior
Migrations should return all promises and not warn on extra promises not returning.
Minimal reproduction of the problem with instructions
we have a psql db. we are currently running the following versions:
db-migrate: 0.10.0
db-migrate-pg: 0.2.5
I have tried the latest published versions and still get the same error.
install the latest version of db-migrate and db-migrate-pg and run a migration.
I am attempting to run db-migrate up with no migrations (just to see if the warning goes away without our migrations)
As a side note our migrations are all of the callback variety. It is happening for our whole team.
What is the motivation / use case for changing the behavior?
I would think that if db-migrate is leaving promises un-resolved they would like to know about it verify where (if it is in your codebase) and resolve them and if not then perhaps pin bluebird and notify them of the warnings.
Or
If its something in how we are currently using db-migrate we'd like to modify how we are doing things to remove the warning.
Environment
The text was updated successfully, but these errors were encountered: