app_1 |
app_1 | 2018-02-16T14:03:22.213Z - info: deserializeUser: f93741fb-0d4c-4d15-b200-dd40ca233e08
app_1 | 2018-02-16T14:03:22.222Z - error: TypeError: Cannot read property 'charAt' of undefined
app_1 | at Object._decompress (/hackmd/node_modules/lz-string/libs/lz-string.js:473:24)
app_1 | at Object.decompressFromBase64 (/hackmd/node_modules/lz-string/libs/lz-string.js:44:21)
app_1 | at parseNoteIdByLZString (/hackmd/lib/models/note.js:196:33)
app_1 | at /hackmd/node_modules/async/dist/async.js:3853:24
app_1 | at replenish (/hackmd/node_modules/async/dist/async.js:946:17)
app_1 | at iterateeCallback (/hackmd/node_modules/async/dist/async.js:931:17)
app_1 | at /hackmd/node_modules/async/dist/async.js:906:16
app_1 | at /hackmd/node_modules/async/dist/async.js:3858:13
app_1 | at Model.<anonymous> (/hackmd/lib/models/note.js:186:26)
app_1 | at Model.tryCatcher (/hackmd/node_modules/bluebird/js/release/util.js:16:23)
app_1 | at Promise._settlePromiseFromHandler (/hackmd/node_modules/bluebird/js/release/promise.js:512:31)
app_1 | at Promise._settlePromise (/hackmd/node_modules/bluebird/js/release/promise.js:569:18)
app_1 | at Promise._settlePromise0 (/hackmd/node_modules/bluebird/js/release/promise.js:614:10)
app_1 | at Promise._settlePromises (/hackmd/node_modules/bluebird/js/release/promise.js:693:18)
app_1 | at Async._drainQueue (/hackmd/node_modules/bluebird/js/release/async.js:133:16)
app_1 | at Async._drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:143:10)
app_1 | at Immediate.Async.drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:17:14)
app_1 | Unhandled rejection Error: Callback was already called.
app_1 | at /hackmd/node_modules/async/dist/async.js:903:32
app_1 | at /hackmd/node_modules/async/dist/async.js:3858:13
app_1 | at Model.<anonymous> (/hackmd/lib/models/note.js:190:22)
app_1 | at Model.tryCatcher (/hackmd/node_modules/bluebird/js/release/util.js:16:23)
app_1 | at Promise._settlePromiseFromHandler (/hackmd/node_modules/bluebird/js/release/promise.js:512:31)
app_1 | at Promise._settlePromise (/hackmd/node_modules/bluebird/js/release/promise.js:569:18)
app_1 | at Promise._settlePromise0 (/hackmd/node_modules/bluebird/js/release/promise.js:614:10)
app_1 | at Promise._settlePromises (/hackmd/node_modules/bluebird/js/release/promise.js:689:18)
app_1 | at Async._drainQueue (/hackmd/node_modules/bluebird/js/release/async.js:133:16)
app_1 | at Async._drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:143:10)
app_1 | at Immediate.Async.drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:17:14)
app_1 | at runCallback (timers.js:672:20)
app_1 | at tryOnImmediate (timers.js:645:5)
app_1 | at processImmediate [as _immediateCallback] (timers.js:617:5)
It would be helpful, when you provide some information about how you got this error.
As we need to reproduce it to fix it or at least make sure it doesn't appear anymore.
It actually seems to be a very special problem, as it's a function that is used everytime you open a note and never appeared by someone else (who reported it) right now.
I could reproduce it here: https://hackmd-ce.herokuapp.com/zadachi

@DenisValeev Hi, thanks for reporting this.
This issue is caused by the id extracted from the note url is an invalid base64 string.
Normally this should just be parsed as null or undefined string, but in this case it corrupted.
I would suggest to address this issue to the lib we use for encode UUID - LZString
https://github.com/pieroxy/lz-string
I'm able to reproduce this issue in http://pieroxy.net/blog/pages/lz-string/demo.html using dev tool.
The error line is in: https://github.com/pieroxy/lz-string/blob/master/libs/lz-string.js#L473
BTW, we should still response this error as 500 to user, I'll make a PR for this.
Awesome @jackycute!
Should create a page with an arbitrary name in the free url mode instead of a 500 error.
This will automatically happen once the upstream is is fixed. As it should return an undefined or null and this will simply work as expected then, as this is already the current flow.
Fixed by #743
I'm encountering this issue on a freshly 1.1.0-CE upgraded HackMD :|
Any idea, could I have made a mistake in the upgrade process ?
@dekonnection Where did you encountered it? While opening a document?
No you didn't do anything wrong during upgrade. It's can appear during the internal migration process but should work anyways. Do you see 500 or other error pages?
I don't see any error page, the application is running correctly on the user side, but this error appears server-side at each page load.
Another precision, when I talked about a mistake during the upgrade process :
I ran into a problem with the sequelize database migration, db:migrate tried to run all migration files in lib/migrations, even the old ones starting from 2015.
As expected, it failed at 20150702001020-update-to-0_3_1.js (duplicate column).
So, I manually added all the "old" migration file names in the SequelizeMeta table, leaving the 3 more recent ones, and the db:upgrade ran fine, then.
This HackMD instance database is running on MySQL.
I'm running another instance on PostgreSQL, and the upgrade went perfectly.
I planned to do some tests to reproduce this behavior before opening another issue about the db:migrate problem on mysql, if confirmed.
Yes, this error (about LZ-String) appears more often. (And I really want to fix it.) It doesn't break anything and in the original PR it was just ignored, but I wanted error logs. Now we get them ^^
I'll provide a fix for that and maybe provide a further release during the next week.
For you migration problem, I'm not aware of problems with these migrations but I only test mysql very basically and not down from 0.3.1. So maybe there is a problem, yes, feel free to provide an issue about that, but as it's pretty old, I don't know how and if we can fix it. Maybe it was something more manual to do.
OK, good to know :+1:
It seems I wasn't clear enough in my descriptions : I was upgrading a 1.0.1 to 1.1.0, and for some reason, sequelize tried tried to run all migrations from the beginning, even the irrelevant (old) ones.
This instance installation has been done at 1.0.1, no db migration happened before that one.
(this is my first upgrade)
Maybe SequelizeMeta needs to be pre-populated ?
(I need to do more tests on that)
Thanks :)
The migration error shouldn't happen, if it does, please open another issue for that.
I have the similar issue after updating from 1.0.1 to 1.1.0.
It does not cause problems but floods the server log:
2018-06-20T17:50:38.983Z - info: deserializeUser: 7c05523f-c3ba-40e7-a781-0fcfd61b6a40
2018-06-20T17:50:38.988Z - error: TypeError: Cannot read property 'charAt' of undefined
at Object._decompress (/hackmd/node_modules/lz-string/libs/lz-string.js:473:25)
at Object.decompressFromBase64 (/hackmd/node_modules/lz-string/libs/lz-string.js:44:21)
at Model.<anonymous> (/hackmd/lib/history.js:35:29)
at Model.tryCatcher (/hackmd/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/hackmd/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/hackmd/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/hackmd/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/hackmd/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/hackmd/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
I'm seeing this error on b1d1f469de7d5df8b58c9dee94b23c1cf7527b91
2018-07-04T13:30:09.270Z - error: TypeError: Cannot read property 'charAt' of undefined
at Object._decompress (/home/hackmd/hackmd/node_modules/lz-string/libs/lz-string.js:473:25)
at Object.decompressFromBase64 (/home/hackmd/hackmd/node_modules/lz-string/libs/lz-string.js:44:21)
at Model.<anonymous> (/home/hackmd/hackmd/lib/history.js:35:29)
at Model.tryCatcher (/home/hackmd/hackmd/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/hackmd/hackmd/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/hackmd/hackmd/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/hackmd/hackmd/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/hackmd/hackmd/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/home/hackmd/hackmd/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/hackmd/hackmd/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/home/hackmd/hackmd/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
Same issue for me but after upgrading to 1.2.0.
Is there a solution how to solve this smoothly until now or should I open a new issue for that?
2018-09-08T22:03:33.044Z - error: TypeError: Cannot read property 'charAt' of undefined
at Object._decompress (/hackmd/node_modules/lz-string/libs/lz-string.js:473:25)
at Object.decompressFromBase64 (/hackmd/node_modules/lz-string/libs/lz-string.js:44:21)
at Model.<anonymous> (/hackmd/lib/history.js:35:29)
at Model.tryCatcher (/hackmd/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/hackmd/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/hackmd/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/hackmd/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/hackmd/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/hackmd/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
@JayDee2202 This should disappear completely after https://github.com/hackmdio/codimd/commit/b028baf77f3b897e8ba9d83928c67a16b602b8c5. This commit will be in 1.2.1 so right now, you still see the error, but it shouldn't break anything
Hello again!
I updated to version 1.2.1 but the error still remains, including the error message at the frontend. Everything works, but the message is still there. If I click on "reload" the site reloads and the message reappears. By clicking the X everything works normally at the frontend.
I'm using docker with postgres sql and update via the container.
Is there any step of the data migration missing?
2018-10-10T15:44:27.336Z - info: deserializeUser: e6ab033f-dd78-4208-b4d3-0a0d63d85ca4
2018-10-10T15:44:27.406Z - error: TypeError: Cannot read property 'charAt' of undefined
at Object._decompress (/hackmd/node_modules/lz-string/libs/lz-string.js:473:25)
at Object.decompressFromBase64 (/hackmd/node_modules/lz-string/libs/lz-string.js:44:21)
at Model.<anonymous> (/hackmd/lib/history.js:35:29)
at Model.tryCatcher (/hackmd/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/hackmd/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/hackmd/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/hackmd/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/hackmd/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/hackmd/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/hackmd/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)

@JayDee2202 This sounds broken, can you open a separate issue for the reload thing?
About the LZ-String thing, can you share your current compose file (without the secrets) and how you updated?