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

fix: don't poll HTTP on startup to prevent dependency cycle between framework dev server and Netlify Dev #5558

Merged
merged 4 commits into from
Mar 26, 2024

Conversation

Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Mar 25, 2024

Summary

Resolves https://linear.app/netlify/issue/COM-550/cannot-boot-ntl-dev-on-astro-project-using-functions-and-edge


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures
    we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures
    your code follows our style guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@Skn0tt Skn0tt self-assigned this Mar 25, 2024
@Skn0tt Skn0tt requested review from a team as code owners March 25, 2024 09:53
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing Astro-specific in the issue though. Which other frameworks should do the same?

@Skn0tt
Copy link
Member Author

Skn0tt commented Mar 25, 2024

I guess every framework that might use passthrough requests. Do we have a list of them?

@ascorbic
Copy link
Contributor

These are normal Netlify functions or edge functions, so basically any framework.

@Skn0tt
Copy link
Member Author

Skn0tt commented Mar 25, 2024

Hmm, that feels weird. We have HTTP as a polling strategy for almost all of our frameworks - wouldn't they all suffer from this problem? Alternatively, what if we change the polling mechanism in CLI so that it starts up the function server, even if the framework dev server isn't fully running yet?

@ascorbic
Copy link
Contributor

Yes, they would all suffer from this. To be clear: it's quite a niche issue, which is why it hasn't come up before afaik. It's a site that calls one of its own functions when rendering the index page via SSR. I'd say that's an anti-pattern, tbh

@Skn0tt
Copy link
Member Author

Skn0tt commented Mar 26, 2024

We discussed this a bit more in https://linear.app/netlify/issue/COM-550/cannot-boot-ntl-dev-on-astro-project-using-functions-and-edge#comment-4b579375, and there seems to be consensus that there's no reason to check HTTP when polling for the framework server. So I removed the HTTP polling strategy from all frameworks in c84ec68.

@ascorbic
Copy link
Contributor

Some overly-specific tests need updating

@Skn0tt
Copy link
Member Author

Skn0tt commented Mar 26, 2024

Updated them in 2320bf6.

Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change the title before merging, to be more specific about what's changed

@Skn0tt Skn0tt changed the title fix: break infinite loop on Astro dev server startup fix: don't poll HTTP on startup to prevent dependency cycle between framework dev server and Netlify Dev Mar 26, 2024
@Skn0tt Skn0tt enabled auto-merge (squash) March 26, 2024 12:51
@Skn0tt Skn0tt merged commit 0291702 into main Mar 26, 2024
36 checks passed
@Skn0tt Skn0tt deleted the astro-poll-tcp branch March 26, 2024 12:53
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

Successfully merging this pull request may close these issues.

None yet

2 participants