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

page render fail when server api not ready. #20844

Closed
transtone opened this issue May 15, 2023 · 7 comments
Closed

page render fail when server api not ready. #20844

transtone opened this issue May 15, 2023 · 7 comments

Comments

@transtone
Copy link

transtone commented May 15, 2023

Environment

  • Operating System: Windows_NT
  • Node Version: v18.15.0
  • Nuxt Version: 3.4.3
  • Nitro Version: 2.3.3
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: modules, experimental, css, colorMode, nitro, app, build, pwa, devtools
  • Runtime Modules: @vueuse/nuxt@10.1.2, @unocss/nuxt@0.51.12, @pinia/nuxt@0.4.10, @nuxtjs/color-mode@3.2.0, @vite-pwa/nuxt@0.0.7
  • Build Modules: -

Reproduction

https://github.com/transtone/vitesse-nuxt3

Describe the bug

If use top lever await in server api. On waiting, it will get a 500 page with message: Cannot access 'renderer$1' before initialization

Additional context

No response

Logs

No response

relation issue:
#20576

@danielroe
Copy link
Member

Nitro does not support top-level await. (Instead, you can use defineLazyEventHandler in these situations.)

cc: @pi0

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2023
@transtone
Copy link
Author

#14348 (comment)

@transtone
Copy link
Author

the key is Cannot access 'renderer$1' before initialization, not only top-level await, but other nitro wait cause this.

why client hmr can't wait till nitro is ready?

@transtone transtone reopened this May 21, 2023
@transtone
Copy link
Author

the key problem is, when the error start, the whole client gos wrong forever! all page become the error page, refresh and reopen has no effect.
image

it MUST kill the server and restart it.

@danielroe
Copy link
Member

Would you provide a reproduction without using top-level await? 🙏

@danielroe
Copy link
Member

~> linking #13893

@transtone
Copy link
Author

This problem appeared in an internal project with server/api, It hard to trace the real problem.
but when update to nuxt-3.5.2 with #21008, it never appeared again.

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

No branches or pull requests

2 participants