hackmdio / codimd

CodiMD - Realtime collaborative markdown notes on all platforms.
https://hackmd.io/c/codimd-documentation
GNU Affero General Public License v3.0
9.32k stars 1.06k forks source link

Error 500 since 0.4.2 upgrade #131

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hello there,

Since the last update I have the following error: SequelizeDatabaseError: ER_BAD_FIELD_ERROR: Unknown column 'owner.accessToken' in 'field list', what can I do? Thanks in advance.

jackycute commented 8 years ago

You have to do db migration

  1. npm install making sure you install the latest packages.
  2. Modify the file named .sequelizerc, change the value of the variable url with your db connection string.
  3. node_modules/.bin/sequelize db:migrate to do db migration

See more here

ghost commented 8 years ago

Thanks for the answer but what is the "db connection string" ?

jackycute commented 8 years ago

It means the URI which will use to connect your DB. For example: postgres://username:password@localhost:5432/hackmd

ghost commented 8 years ago

Thanks!

It worked well but 500 error is still here:

2016-06-01T21:09:38.253Z - info: HTTP Server listening at port 3000
2016-06-01T21:09:42.548Z - info: ::ffff:127.0.0.1 - - [01/Jun/2016:21:09:42 +0000] "GET /500 HTTP/1.1" 500 - "https://md.unixcorn.org/GYZgjApgLAHAbAQwLQLgIwOxKhgJrlCBKJGATjinTJgGMwAGDIA=" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17"

2016-06-01T21:09:42.610Z - info: ::ffff:127.0.0.1 - - [01/Jun/2016:21:09:42 +0000] "GET /vendor/bootstrap/dist/css/bootstrap.min.css HTTP/1.1" 304 - "https://md.unixcorn.org/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17"

Thanks again for your time. 👍

jackycute commented 8 years ago

Huh, the logs show nothing I can help. Usually when 500 error should give you more infos in the logs. Please tell more about your system environment, are you using docker-hackmd?

Did you run npm install and bower install after upgrade? Maybe refresh your browser many times? Restart your browser and try again? Or restart your server then try again?

Thanks.

ghost commented 8 years ago

I didn't use Docker, HackMD run in a CT. Which I putted back in a previous state before the upgrade. So I followed what you tell me to do to a clean upgrade and now I have an other error. error: SequelizeDatabaseError: ER_BAD_FIELD_ERROR: Unknown column 'refreshToken' in 'field list'

Thanks for helping.

jackycute commented 8 years ago

No problem.

I think that's the same error, the column field can't be found in some table. You need to do db migration again.

ghost commented 8 years ago

I didn't understand because I have already take care of the db migration, as Node told me:

Sequelize [Node: 6.2.0, CLI: 2.4.0, ORM: 3.22.0]

Parsed url mysql://umd:*****@localhost:3306/umd
No migrations were executed, database schema was already up to date.

Now I can't access to pages, there is just: internal error on white blank screen.

jackycute commented 8 years ago

Because you've done db migration before. There is a table called SequlizeMeta which indicate your migration status, you need to remove it in order to do that again.

jackycute commented 8 years ago

Join gitter here and we can have more instant talk.

yysu commented 8 years ago

I have the same question when use Postgresql db to open a new note. It showed 500 error :

2016-06-03T06:57:42.199Z - error:  SequelizeDatabaseError: column owner.accessToken does not exist
    at Query.formatError (/Users/yanyunsu/Desktop/hackmd/node_modules/sequelize/lib/dialects/postgres/query.js:357:14)
    at null.<anonymous> (/Users/yanyunsu/Desktop/hackmd/node_modules/sequelize/lib/dialects/postgres/query.js:88:19)
    at emitOne (events.js:77:13)
    at emit (events.js:169:7)
    at Query.handleError (/Users/yanyunsu/Desktop/hackmd/node_modules/pg/lib/query.js:108:8)
    at null.<anonymous> (/Users/yanyunsu/Desktop/hackmd/node_modules/pg/lib/client.js:171:26)
    at emitOne (events.js:77:13)
    at emit (events.js:169:7)
    at Socket.<anonymous> (/Users/yanyunsu/Desktop/hackmd/node_modules/pg/lib/connection.js:109:12)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    at TCP.onread (net.js:531:20)

But Mysql worked well.

jackycute commented 8 years ago

How strange... @YYSU Did you do DB migration with PostgreSQL too?

yysu commented 8 years ago

I forked the latest version ,so I didn't do DB migration with both. I just did the DB migration with PostgreSQL, Now It works well ! Thanks again for helping.

jackycute commented 8 years ago

@matunixe Hi, are you still trying?

jackycute commented 8 years ago

@matunixe I also found you actually can do node_modules/.bin/sequelize db:migrate:undo to revert the previous migration.

jackycute commented 8 years ago

So basically this issue will definitely happen when you forget to do db migration after upgrade. I assume this was solved, @matunixe please reopen if you need further helps. Thx!

ghost commented 8 years ago

Sorry to not answered you earlier @jackycute. I didn't have the time to make tests and debug furthermore for the moment, so I just rollback the state of my container with the precedent snapshot and didn't make the upgrade for the moment.

jackycute commented 8 years ago

It's ok @matunixe. Next time when you trying to upgrade, check the upgrade guide in the README.md first, I will keep update it. Good luck!