You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running migrate:up - we are getting the error TypeError: classes[key] is not a constructor. The error is coming from node_modules/mongo-migrate-ts/lib/migrations.ts 38:19.
This error could be due to something in our code but we cannot see where or what because the migrations.ts is not forwarding the error. We have removed all our code from migrations and still see this error.
Our config is as follows and we can confirm this worked at some point but as of late it started throwing the above error.
// file: /migrations/index.tsimport{mongoMigrateCli}from"mongo-migrate-ts";// v1.6.2constconfig={db: "our_db",mongoUri: "mongodb+srv://"};mongoMigrateCli({database: config.db,uri: config.mongoUri,migrationsDir: '.',// Directory where your migration files are storedmigrationsCollection: 'migrations',// Collection to store migration status});
Full Error:
✖ Error executing migrations
Example app listening on port 3000
TypeError: classes[key] is not a constructor
at /Users/yser/Documents/projects/cbs/project-v3/node_modules/.pnpm/[email protected][email protected]/node_modules/mongo-migrate-ts/lib/migrations.ts:38:19
at Array.map (<anonymous>)
at loadMigrationFile (/Users/yser/Documents/projects/cbs/project-v3/node_modules/.pnpm/[email protected][email protected]/node_modules/mongo-migrate-ts/lib/migrations.ts:34:6)
at async Promise.all (index 2)
at async loadMigrations (/Users/yser/Documents/projects/cbs/project-v3/node_modules/.pnpm/[email protected][email protected]/node_modules/mongo-migrate-ts/lib/migrations.ts:51:22)
at async up (/Users/yser/Documents/projects/cbs/project-v3/node_modules/.pnpm/[email protected][email protected]/node_modules/mongo-migrate-ts/lib/commands/up.ts:38:27)
at async Command.<anonymous> (/Users/yser/Documents/projects/cbs/project-v3/node_modules/.pnpm/[email protected][email protected]/node_modules/mongo-migrate-ts/lib/cli.ts:57:11)
ELIFECYCLE Command failed with exit code 1.
The text was updated successfully, but these errors were encountered:
I had the same error when I was exporting multiple functions from the migration class. Made sure i'm only exporting the class that implements the MigrationInterface and it worked again for me.
Hi,
When running migrate:up - we are getting the error
TypeError: classes[key] is not a constructor
. The error is coming fromnode_modules/mongo-migrate-ts/lib/migrations.ts 38:19
.This error could be due to something in our code but we cannot see where or what because the migrations.ts is not forwarding the error. We have removed all our code from migrations and still see this error.
Our config is as follows and we can confirm this worked at some point but as of late it started throwing the above error.
package.json:
Full Error:
The text was updated successfully, but these errors were encountered: