memos icon indicating copy to clipboard operation
memos copied to clipboard

Unhandled Thrown Error! Cannot read properties of undefined (reading 'count')

Open AlwaysKris opened this issue 1 year ago • 2 comments

Hi, when I open memos today, there are some error log displayed on the page and can not view my memos. here are some error logs below. (version 0.4.5)

Unhandled Thrown Error!
Cannot read properties of undefined (reading 'count')
TypeError: Cannot read properties of undefined (reading 'count')
    at https://xxx.xx/assets/index.f618fa86.js:107:19652
    at Qs (https://xxx.xx/assets/index.f618fa86.js:32:24425)
    at ci (https://xxx.xx/assets/index.f618fa86.js:32:42666)
    at S9 (https://xxx.xx/assets/index.f618fa86.js:32:41472)
    at so (https://xxx.xx/assets/index.f618fa86.js:32:40498)
    at ty (https://xxx.xx/assets/index.f618fa86.js:32:37079)
    at Xn (https://xxx.xx/assets/index.f618fa86.js:30:3274)
    at https://xxx.xx/assets/index.f618fa86.js:32:34432
💿 Hey developer 👋

You can provide a way better UX than this when your app throws errors by providing your own errorElement props on <Route>

AlwaysKris avatar Sep 26 '22 05:09 AlwaysKris

@theChrisWei Sorry, I cannot reproduce on my local computer and demo. Could you please join the telegram group and send me your database file (desensitized first)?

boojack avatar Sep 26 '22 11:09 boojack

sure, I will pm u on tg.

AlwaysKris avatar Sep 26 '22 11:09 AlwaysKris

After some talks in telegram, it might be a cache problem from vite-plugin-pwa. And it had been removed: https://github.com/usememos/memos/commit/a2180f177fdd2e0637cb9ffa04656c8e4275131d

boojack avatar Sep 26 '22 14:09 boojack

@boojack I have the same issue/error after upgrade to the latest v0.5.0..

DHS1001 avatar Oct 05 '22 00:10 DHS1001

@boojack I have the same issue/error after upgrade to the latest v0.5.0..

yep, i can still reproduce on v0.5.0

AlwaysKris avatar Oct 05 '22 01:10 AlwaysKris

If you encounter the same error, please clear your browser cache. If not, give me the details of the error.

boojack avatar Oct 05 '22 01:10 boojack

@boojack It is a similar error as above, the browser cache has been cleared, but no luck. Also tried in mobile and another computer, but it is the same error.

Environment:

  • Memos has been set up via docker in a Synology
  • Win 10 64bit, Edge Version 106.0.1370.34 (Official build) (64-bit)

The below error appears when fetching data after logging in. image

DHS1001 avatar Oct 05 '22 02:10 DHS1001

@DHS1001 Could you please join the telegram group and send me your database file (desensitized first)?

boojack avatar Oct 05 '22 12:10 boojack

@boojack One more finding is the explore page works properly.

Looking at the docker log:

███╗   ███╗███████╗███╗   ███╗ ██████╗ ███████╗
████╗ ████║██╔════╝████╗ ████║██╔═══██╗██╔════╝
██╔████╔██║█████╗  ██╔████╔██║██║   ██║███████╗
██║╚██╔╝██║██╔══╝  ██║╚██╔╝██║██║   ██║╚════██║
██║ ╚═╝ ██║███████╗██║ ╚═╝ ██║╚██████╔╝███████║
╚═╝     ╚═╝╚══════╝╚═╝     ╚═╝ ╚═════╝ ╚══════╝

Version 0.5.0 has started at :5230
{"time":"2022-10-11T10:29:48Z","method":"GET","uri":"/auth","status":200,"error":""}
{"time":"2022-10-11T10:29:48Z","method":"GET","uri":"/assets/index.19a074d4.css","status":200,"error":""}
{"time":"2022-10-11T10:29:48Z","method":"GET","uri":"/assets/index.06aad460.js","status":200,"error":""}
{"time":"2022-10-11T10:29:49Z","method":"GET","uri":"/logo-full.webp","status":200,"error":""}
{"time":"2022-10-11T10:29:49Z","method":"GET","uri":"/api/user/me","status":401,"error":"code=401, message=Missing user in session"}
{"time":"2022-10-11T10:29:49Z","method":"GET","uri":"/api/status","status":200,"error":""}
{"time":"2022-10-11T10:29:49Z","method":"GET","uri":"/sw.js","status":200,"error":""}
{"time":"2022-10-11T10:29:49Z","method":"GET","uri":"/logo.webp","status":200,"error":""}
{"time":"2022-10-11T10:29:49Z","method":"GET","uri":"/manifest.json","status":200,"error":""}
{"time":"2022-10-11T10:29:49Z","method":"GET","uri":"/logo.webp","status":200,"error":""}
{"time":"2022-10-11T10:29:52Z","method":"POST","uri":"/api/auth/signin","status":200,"error":""}
{"time":"2022-10-11T10:29:52Z","method":"GET","uri":"/api/user/me","status":200,"error":""}
{"time":"2022-10-11T10:29:52Z","method":"GET","uri":"/api/status","status":200,"error":""}
{"time":"2022-10-11T10:29:52Z","method":"GET","uri":"/api/user/me","status":200,"error":""}
{"time":"2022-10-11T10:29:52Z","method":"GET","uri":"/api/shortcut?","status":200,"error":""}
{"time":"2022-10-11T10:29:52Z","method":"GET","uri":"/api/memo?rowStatus=NORMAL","status":200,"error":""}
{"time":"2022-10-11T10:29:52Z","method":"GET","uri":"/logo.webp","status":200,"error":""}
{"time":"2022-10-11T10:29:53Z","method":"GET","uri":"/api/tag?","status":200,"error":""}
...
...

From the db structure, the NOT working db file is missing the below three triggers compare with the fresh install db file.

image

And the memo_resource table in the NOT working db file has no records, with the resource table has records after the migration to 0.5.

DHS1001 avatar Oct 11 '22 11:10 DHS1001

@DHS1001 Thanks for your so detailed report, I will take a deep look as soon as possible.

boojack avatar Oct 11 '22 13:10 boojack

Thanks @boojack, hope this is helpful to identify the root cause and get this issue resolved. Feel free to let me know if you need more information.

DHS1001 avatar Oct 11 '22 23:10 DHS1001

@DHS1001

  • For these missing triggers, I have upserted a patch into 0.5.0 image and will re-create all of them in 0.6.0.
  • And it is normal that the memo_resource table has no records. The table is using for saving the related resource with memo, so it should be empty in the latest version.

boojack avatar Oct 13 '22 00:10 boojack

Thanks for the quick fix @boojack Looking forward to version 0.6.0

DHS1001 avatar Oct 13 '22 02:10 DHS1001

@DHS1001 v0.6.0 has been released. FYI

boojack avatar Oct 14 '22 22:10 boojack

Thanks @boojack, the issue still persists after the upgrade to v0.6.0 unfortunately.

Unhandled Thrown Error!
Cannot read properties of undefined (reading 'count')

Anything more we can check to find the cause or this issue?

DHS1001 avatar Oct 17 '22 04:10 DHS1001

Thanks @boojack, the issue still persists after the upgrade to v0.6.0 unfortunately.

Could you please clean the browser cache firstly or check it in private mode?

boojack avatar Oct 17 '22 05:10 boojack

Could you please clean the browser cache firstly or check it in private mode?

@boojack Tried to clear the cache, and ran in edge InPrivate windows, the same error appeared.

DHS1001 avatar Oct 17 '22 05:10 DHS1001

Could you please clean the browser cache firstly or check it in private mode?

@boojack Tried to clear the cache, and ran in edge InPrivate windows, the same error appeared.

@boojack Tried same approach(clear che cache) as @DHS1001, the issue still exists. 100% reproduce scene: after I change the date of some memo(say change today memo's date to 2022-09-09) and refresh the page, the exception happen (my timezone is New Zealand Daylight Time). I can share via screen sharing if u need.

AlwaysKris avatar Oct 17 '22 05:10 AlwaysKris

Unhandled Thrown Error!
Cannot read properties of undefined (reading 'count')

@DHS1001 It looks like a front-end error message, can you give me the details of an error network request?

@DHS1001 @AlwaysKris I think a quick way to solve this problem is to use the latest database schema. You can save your old database file and generate a new one, then copy the old data to the new one.

boojack avatar Oct 18 '22 00:10 boojack

Thanks @boojack, Looks like the issue is resolved after the upgrade to v0.6.1.

DHS1001 avatar Oct 23 '22 22:10 DHS1001