I'm currently adopting a project that was built on Loopback. I'm trying to switch to a dev database, and have approached the problem mostly through a find and replace tactic.
After changing all references to the production database to point at the development one instead, I'm getting the error:
Cannot start the application. Error: The connector has not been initialized.
at PostgresDataSource.freeze (project/api/node_modules/loopback-datasource-juggler/lib/datasource.js:1982:11)
at PostgresDataSource.DataSource.autoupdate (project/api/node_modules/loopback-datasource-juggler/lib/datasource.js:1068:8)
at InstrideIdentityApiApplication.migrateSchema (project/api/node_modules/@loopback/repository/dist/mixins/repository.mixin.js:186:40)
at <anonymous>
I don't know what this means. I've tried searching the git for loopback to find the error code, but got no results. I've looked into the docs on connectors, but it did not illuminate at what stage a connector becomes "initialized."
My questions are:
What exactly is this error trying to tell me?
The error is telling you that your datasource does not have any connector configured. If you look at the stack trace, the error was triggered when migrateSchema
was called. Without a connector, the datasource does not know how to connect to a database, and thus it cannot perform schema migration.
What does one typically do to fix it?
Make sure your datasource configuration contains connector
property.