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

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'accept') #460

Closed
hamedg68 opened this issue Sep 20, 2022 · 13 comments

Comments

@hamedg68
Copy link

Description

after fetching packages and run vuefull example at last commit (0.4.36), showing runtime error

Error Stack

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'accept') at Counter.vue:2:56
@brillout
Copy link
Member

That's unrelated to vps.

That's probably a problem somewhere between Vue and Vite. Does updating the dependencies solve the problem?

@hamedg68
Copy link
Author

hamedg68 commented Sep 20, 2022

if I change vite version from ^3.0.4 to 3.0.4 the error can be removed but clientRouting has runtime error while it is true in _default.page.client.ts file

Uncaught (in promise) Error: [vite-plugin-ssr@0.4.36][Wrong Usage] navigate() is only available when using Client Routing

@brillout
Copy link
Member

I cannot reproduce (I updated all dependencies expect of vite which I pinned to 3.0.4).

Can you publish a reproduction leading to Uncaught (in promise) Error: [vite-plugin-ssr@0.4.36][Wrong Usage] navigate() is only available when using Client Routing?

@brillout
Copy link
Member

As for the Vite-Vue bug, I can indeed reproduce it. The best would be the create a reproduction starting from npm init vite-plugin-ssr@latest and create a new GitHub ticket over at Vite.

@hamedg68
Copy link
Author

hamedg68 commented Sep 21, 2022

This is repo in Stackblitz and GitHub:

https://stackblitz.com/github/hamedg68/vps-V0.4.36?file=pages/index/index.page.vue

1 - the counter button does not work with this runtime error :
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'accept') at Counter.vue:2:56

2 - change vite version from ^3.0.4 to 3.0.4
counter button works but client routing gives this error :
Uncaught (in promise) Error: [vite-plugin-ssr@0.4.36][Wrong Usage] navigate() is only available when using Client Routing

if using vite version "3.0.4" and vite-plugin-ssr version "0.4.31" both errors gone !!!

@brillout
Copy link
Member

I could reproduce both errors.

For the first error, it's a Vite bug, so we should create a Vite ticket for that.

As for the second error, it's fixable on vite-plugin-ssr's side. It's not a completely trivial fix (Vite's latest version breaks an assumption that vite-plugin-ssr repeatedly relies on). ETA later today / tomorrow.

@hamedg68
Copy link
Author

hamedg68 commented Sep 22, 2022

for those who want to use current latest vps version(v0.4.36) without any error set vite version to 3.1.0-beta.1

@brillout
Copy link
Member

Alright, the second error is fixed in 0.4.38. We should create a minimal reproduction showcasing the first error (using 0.4.38) and create a new GitHub ticket at Vite's repository. @hamedg68 Up for the task? 🙏

without any error set vite version to 3.1.0-beta.1

👍 Thanks, good to know.

@milanio
Copy link

milanio commented Sep 22, 2022

I believe the first problem is linked to the same problem as #461 .
Error Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'accept') at Counter.vue:2:56 disappears when you set "target": "ES2020" in tsconfig.json.
The error is actually coming from calling import.meta.hot.accept()

@brillout
Copy link
Member

I actually did try setting vite.config.js#esbuild.target to esnext and it didn't work.

Thanks @milanio.

@brillout
Copy link
Member

@hamedg68 Up for the task? 🙏

Done.

@hamedg68
Copy link
Author

hamedg68 commented Sep 24, 2022

@brillout
Copy link
Member

https://stackblitz.com/github/hamedg68/vps-V0.4.38

That's expected until Vite fixes the bug.

@brillout brillout changed the title vuefull example runtime error Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'accept') Sep 28, 2022
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