-
Notifications
You must be signed in to change notification settings - Fork 378
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
[Bug?]: /_server request gets stuck with async code inside middleware #1165
Comments
Yup very peculiar. Will have to debug this carefully. |
@nksaraf I think the issue is this. The middleware in front of the server function creats a solid-start/packages/start/server/middleware.ts Lines 59 to 62 in a9b4b05
If I understand it correctly the unreleated await gives node a chance to read chunks and later we get stuck trying to read a request body that has already been read. solid-start/packages/start/config/server-handler.js Lines 102 to 103 in a9b4b05
I verified this by replacing solid-start/packages/start/server/middleware.ts Lines 20 to 25 in a9b4b05
|
Ohh I think I faced something similar here: unjs/h3#570 Okay I think we should do the proxy approach anyway so that nothing is called lazily. |
ah interessting... you already ran into that. So we would proxy the WebRequest and make sure the body is not read eagerly right? |
I wonder if we should push this upwards to vinxi's server utils as well |
Pulling this upstream into vinxi: nksaraf/vinxi#101 |
This reverts commit 3443ba0.
This reverts commit 3443ba0.
Duplicates
Latest version
Current behavior 😯
With the new @solid/start, the
/_server
request gets stuck and shows (pending) as status in Chrome's Network Inspector when using async code inside the middleware. When not using async code, it works fine.Expected behavior 🤔
The request resolves
Steps to reproduce 🕹
Steps:
middleware.ts
, you can see it does work as expectedContext 🔦
Middleware is needed for checking if a user is logged in. It is uses async functions to do that
Your environment 🌎
The text was updated successfully, but these errors were encountered: