-
Notifications
You must be signed in to change notification settings - Fork 125
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
fix: revert changes that cause slow proxying #758
base: main
Are you sure you want to change the base?
Conversation
Hi @johnnyreilly, thanks a lot for helping investigate and fix the issue : ) Instead of reverting, I'd like to test wait-on with node 18 and 20, and then submit a new PR, in order to ensure everything works as expected. I have also observed that some features may fail in Linux or MacOS with node 20, so the team may take time to decide whether and how to support node 20. I'll work on this soon. I look forward to discussing with you again. |
Thanks @cjk7989 - if it helps I work on both Linux and Mac and I'm happy to help with testing in that space. |
We have also pinned 1.1.3, due to the extreme slowness and the difficulties this introduces for local development. I think this should be adjusted to work with the only still supported node versions 18 and 20 and should consider Linux, MacOS and Windows name resolution for localhost. PS: Besides this current problem, the SWA CLI works great and is really enjoyable to work with. |
Hi @johnnyreilly, sorry for the delay of response. I have merged PR #761 to fix this issue. I hope this can help, though swa-cli will support node<=18 in a period of time. Could you test it if you are convenient? Thanks again for paying attention to this issue! Testing steps if needed:
|
Hey @cjk7989, Thanks for this - I did some testing. It's better, but the news isn't great I'm afraid. I took our most demanding client side app, and timed the initial startup with 1.1.3, 1.1.4 and 1.1.5-alpha for comparison. 1.1.5-alpha was half as performant as 1.1.3 - see the screenshots from devtools below: 1.1.31.1.41.1.5-alphaAlso with 1.1.5-alpha the terminal was filled with these messages: [swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173
[swa] [swa] Timed out waiting for: tcp:localhost:5173 |
Hey @johnnyreilly, thanks a lot for testing! I will remove these timeout logs in [email protected]. PS: Though remove wait-on before requesting to dev servers can be faster (as version 1.1.3 does), we can't do this, since we don't know if localhost will be resolved to ipv4 or ipv6. It depends on different framework (e.g. ipv6 for Angular, but ipv4 for React). Do you think the response speed of 1.1.5-alpha is acceptable for you? |
It's pretty slow - I'd stick with 1.1.3 rather than use 1.1.5 |
I'd be quite surprised if the front end framework code affected whether it was ip4 or ip6. Are you sure about that? |
Yes, when starting site localhost:4280, a request will be proxied to the dev server started by these frameworks. For example, |
I'm not sure it's quite like that? For instance, my app is a React app, but I use vite as the Dev server so it's http://localhost:5173 Is it not more down to the Dev server you're using? And couldn't we be specific and once the first request succeeds, store the successful responder and use that to steer all subsequent requests? |
Hi @johnnyreilly, we can't revert to 1.1.3 to speed up because the bug of resolving localhost will occur with node 18 in some systems. But I agree with you to record the successful responder and use that to steer all subsequent requests. We will design a fallback method to resolve requests in the future update. Thanks! |
Thanks @cjk7989! I'm going to pin to 1.1.3 for now, but I'd be more than happy to help with testing when you work on the fallback method. By the way, if you ever want to have a call to discuss this, I'm open to it. In our organisation we use the SWA CLI as a general purpose web development tool that allows us to avoid the hell of CORS. We use it when developing contain apps as well as static web apps So we're highly invested in the success of this tool! |
First of all, happy new year! |
PR #862 updates wait-on (along with a slew of changes for CVEs, ES modules, and later versions of Node). Can you please check that out and see if it fixes your slowness issues as well? @johnnyreilly I'd also like to chat with you on how you are using SWA CLI overall. If you are up for a live discussion on how you use SWA CLI, could you reach out via private email (adhal-at-microsoft) so we can set that up? Thanks! |
This PR addresses #736 which concerns slow proxied requests for static content. These slow proxied requests were caused by the changes made by @cjk7989 in #720
Whilst well intended, these changes fixed one issue that presented with Node.js 18 but introduced a more problematic issue that made the SWA CLI difficult to use for local development where static assets are involved. This change was released with version 1.1.4. Speaking for my own organisation, we have pinned to 1.1.3. Looking at the feedback in #736 this seems a common approach.
Looking at the comments in #736 it's clear this is affecting many people. This PR reverts that change.
Motivations
wait-on
. The original issue is now resolved with Node.js 20 according to @MikeMcC399 comments: wait-on failure for localhost of react-app Node.js 18 jeffbski/wait-on#137 (comment)Finally, I wanted to say a quick thank you! ❤️
I really the love the SWA CLI and use it in my work on a daily basis - thank you for the great tool that it is!