Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
KangBuilds opened this issue Sep 26, 2022 · 20 comments

Comments

@KangBuilds
Copy link

KangBuilds commented Sep 26, 2022

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>
@boojack
Copy link
Collaborator

boojack commented Sep 26, 2022

@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)?

@KangBuilds
Copy link
Author

sure, I will pm u on tg.

@boojack
Copy link
Collaborator

boojack commented Sep 26, 2022

After some talks in telegram, it might be a cache problem from vite-plugin-pwa. And it had been removed: a2180f1

@boojack boojack closed this as completed Sep 26, 2022
@DHS1001
Copy link

DHS1001 commented Oct 5, 2022

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

@KangBuilds
Copy link
Author

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

yep, i can still reproduce on v0.5.0

@boojack
Copy link
Collaborator

boojack commented Oct 5, 2022

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

@DHS1001
Copy link

DHS1001 commented Oct 5, 2022

@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

@boojack
Copy link
Collaborator

boojack commented Oct 5, 2022

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

@DHS1001
Copy link

DHS1001 commented Oct 11, 2022

@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.

@boojack
Copy link
Collaborator

boojack commented Oct 11, 2022

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

@DHS1001
Copy link

DHS1001 commented Oct 11, 2022

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.

@boojack
Copy link
Collaborator

boojack commented Oct 13, 2022

@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.

@DHS1001
Copy link

DHS1001 commented Oct 13, 2022

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

@boojack
Copy link
Collaborator

boojack commented Oct 14, 2022

@DHS1001 v0.6.0 has been released. FYI

@DHS1001
Copy link

DHS1001 commented Oct 17, 2022

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?

@boojack
Copy link
Collaborator

boojack commented Oct 17, 2022

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?

@DHS1001
Copy link

DHS1001 commented Oct 17, 2022

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.

@KangBuilds
Copy link
Author

KangBuilds commented Oct 17, 2022

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.

@boojack
Copy link
Collaborator

boojack commented Oct 18, 2022

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.

@DHS1001
Copy link

DHS1001 commented Oct 23, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants