I am getting a failure whenever I try to add my 15th collection.
errorType': 'Error', 'errorMessage': 'Callback was already called.', 'trace': ['Error: Callback was already called.', ' at eval (webpack://mnUvr-api/./node_modules/async/dist/async.js?:843:36)', ' at eval (webpack://mnUvr-api/./node_modules/waterline/lib/waterline/utils/system/validate-datastore-connectivity.js?:31:14)', ' at eval (webpack://mnUvr-api/./node_modules/machine/lib/private/help-build-machine.js?:952:35)', ' at Function.handlerCbs.error (webpack://mnUvr-api/./node_modules/machine/lib/private/help-build-machine.js?:742:26)', ' at parley.retry (webpack://mnUvr-api/./node_modules/machine/lib/private/help-build-machine.js?:1088:49)', ' at parley (webpack://mnUvr-api/./node_modules/parley/lib/parley.js?:140:5)', ' at Object.runFn [as getConnection] (webpack://mnUvr-api/./node_modules/machine/lib/private/help-build-machine.js?:461:23)', ' at validateDatastoreConnectivity (webpack://mnUvr-api/./node_modules/waterline/lib/waterline/utils/system/validate-datastore-connectivity.js?:27:25)', ' at eval (webpack://mnUvr-api/./node_modules/waterline/lib/waterline.js?:722:18)', ' at Object.success (webpack://mnUvr-api/./node_modules/sails-mongo/lib/index.js?:356:16)', ' at eval (webpack://mnUvr-api/./node_modules/machine/lib/private/help-build-machine.js?:1517:30)', ' at proceedToFinalAfterExecLC (webpack://mnUvr-api/./node_modules/parley/lib/private/Deferred.js?:1155:14)', ' at proceedToInterceptsAndChecks (webpack://mnUvr-api/./node_modules/parley/lib/private/Deferred.js?:913:12)', ' at proceedToAfterExecSpinlocks (webpack://mnUvr-api/./node_modules/parley/lib/private/Deferred.js?:845:10)', ' at eval (webpack://mnUvr-api/./node_modules/parley/lib/private/Deferred.js?:303:7)', ' at eval (webpack://mnUvr-api/./node_modules/machine/lib/private/help-build-machine.js?:954:24)'
This is happening when I get to my 15th collection, I haven't yet decided to create a blank project and see if it repro's in that way.
export const connectToDatabase = (): Promise<void> => {
if (orm) {
return Promise.resolve();
}
return new Promise((resolve, reject) => {
Waterline.start(config, (err: unknown, _orm: Waterline.Waterline) => {
if (err) {
console.error("Could not start up the ORM:\n", err);
return reject(err);
}
orm = _orm as Waterline;
collections = {
Syllabus: getModel("syllabus"),
Clazz: getModel("clazz"),
Move: getModel("move"),
User: getModel<UserModel>("user"),
Family: getModel("family"),
Video: getModel("video"),
ClazzLevel: getModel<ClazzModel>("clazzlevel"),
ClazzMembership: getModel("clazzmembership"),
syllabusOwnership: getModel("syllabusownership"),
series: getModel("series"),
SchoolOwnership: getModel("schoolownership"),
School: getModel("school"),
Product: getModel("product"),
StudentProgress: getModel("studentprogress"),
seriesMembership: getModel("seriesMembership"),
};
resolve();
});
});
};
I have a pretty vanilla connection to database, using Sails-Mongo 2.0. I have been able to use 14 collections without any issue, but I went to add another collection to use, and suddenly I get this error, and I have no idea why.
I don't believe that there is a problem with the model itself, as I have stripped all of the attributes to make it as boring as possible, with no syntax errors, and I still get this error.
For any future person, the issue was with the model name having a capital letter in it.
seriesMembership: getModel("seriesMembership"),
That fails, while the following succeeds:
seriesMembership: getModel("seriesmembership"),