0

I'm trying to docker compose up a test version of a node.js app, and using sequelize-cli commands to create/migrate/seed the mysql database.

While db:migrate works just fine (after I manually create an empty db), trying to run db:drop or db:create beforehand fails with Unhandled rejection TypeError: Cannot read property 'replace' of undefined.

In all 3 commands I am referencing the same (and correct) config file with --config <filepath> added to sequelize-cli commands and I am referencing the correct environment (indicated by logging/validating the process.env object).

I'm wondering why db:drop and db:create would behave this way if db:migrate works fine (and they're given the same config).

I am using Sequelize CLI [Node: 14.18.0, CLI: 5.5.1, ORM: 5.22.5]

1 Answer 1

0

Taking a look at sequelize-cli source made it clear that these commands both required the 'database' arg to be top-level in the config object; we'd been burying those in nested objects and unpacking in production, but not in this case.

That meant the command was recieving a config with no 'database' arg, and the TypeError was simply due to trying string methods on an 'undefined' string.

So double-check your config!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.