3

i'm a beginner and i'm trying to deploy a back-end application. I'm using an aws EC2 with ubuntu server and the problem is as follows. in the application on my machine the command "yarn sequelize db: migrate" runs normally, executes the migrations and creates the tables. but not on the server. I already changed the environment variables, even put the information directly in the code, even so it does not run the migrations. the most it does is: [email protected]: ~ / app / server $ yarn sequelize db: migrate yarn run v1.22.4 $ /home/deploy/app/server/node_modules/.bin/sequelize db: migrate

Sequelize CLI [Node: 14.4.0, CLI: 5.5.1, ORM: 5.21.6]

Loaded configuration file "src / config / database.js". Done in 0.54s.

It is as if I did not enter the migrations folder for any reason

i'm using postgres on docker image.

1 Answer 1

5

TL;DR: try to use the latest version for all the dependencies for sequelize-cli, as shown in the last code block of this response.

I am not 100% sure if this is the same issue I encountered. But I have been stuck in a similar situation for 2 days. Basically when I run "npx sequelize db:migrate", it will show the following,

Sequelize CLI [Node: 14.4.0, CLI: 5.5.1, ORM: 5.21.6]

Loaded configuration file "src / config / database.js".
Using environment "development".

Then it just stopped there! I dived deep into the sequelize-cli library and put some console log statements in to see what's failing. Eventually I found that somehow it's failing in

return sequelize.authenticate().then(() => { 

this line in the /sequelize-cli/lib/core/migrator.js

Eventually, it got me wondering if this is an external dependency issue. Then I use the latest dependencies, as following in my package.json

"dependencies": {
    "pg": "^8.2.1",
    "sequelize": "^5.21.13",
    "sequelize-cli": "^5.5.1"
},

I realized that I was previously using "pg": "^7.18.2". Then this fixed the issue for me.

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

3 Comments

You're a savior! For some reason it only works with the version numbers you specified.
Glad that helps!:) I dug a bit deeper and found that this is the root cause, github.com/sequelize/sequelize/issues/12158
in my case updating pg to version 8.2.1 solved my problem

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.