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

feat: detect internal functions created after dev server already started #6257

Merged
merged 39 commits into from
Jan 2, 2024

Conversation

Skn0tt
Copy link
Contributor

@Skn0tt Skn0tt commented Dec 7, 2023

in #6244 we've merged a change from build that clears the .netlify/functions-internal and .netlify/edge-functions folders on dev startup. We need to update some of our code & tests to handle that, and this PR does it!

The main thing is that right now, we're checking if a .netlify/functions-internal directory exists once on startup. If it doesn't, we don't watch it, and we don't get notified about functions being added to it.

Instead, we should always watch the directory, so any functions added after startup are detected correctly.

This PR fixes all skipped tests one-by-one. It's a rather big refactor, best reviewed commit by commit!

@Skn0tt Skn0tt self-assigned this Dec 7, 2023
@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 7, 2023

depends on netlify/edge-bundler#548 for handling the detected import maps correctly.

Copy link

github-actions bot commented Dec 7, 2023

📊 Benchmark results

Comparing with d74c00d

  • Dependency count: 1,410 ⬆️ 0.78% increase vs. d74c00d
  • Package size: 422 MB ⬆️ 4.06% increase vs. d74c00d
  • Number of ts-expect-error directives: 1,189 ⬇️ 3.53% decrease vs. d74c00d

@Skn0tt Skn0tt marked this pull request as ready for review December 11, 2023 13:20
@Skn0tt Skn0tt requested a review from a team as a code owner December 11, 2023 13:20
@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 11, 2023

looking at that test failure 🤔

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 14, 2023

I can't reproduce this type check failure locally 🤔

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 14, 2023

I can't reproduce this type check failure locally 🤔

Interesting - the CI is pretending that this PR is already merged into main, and running the tests on that state. I could replicate it locally after merging in main. Should be fixed now!

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 21, 2023

Hmm, it looks like there's a test that times out on windows. Looks like i'll need to fire up my VM!

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 21, 2023

Well well, I can't reproduce it locally on windows. I've restarted CI, hopefully it's "just" flaky?

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 21, 2023

Nope, can't replicate locally 😢

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 22, 2023

While debugging via SSH, I was able to narrow it down to one test, and I have a hunch that the test is fixed by 5f05300. The problem was that we weren't awaiting the expectation, so the exception was thrown outside of the test execution. As to why this only occurs now, and only on Windows, I don't have a convincing answer - maybe the changes made the stars align subtly so that the event loop now notices the uncaught rejection.

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 22, 2023

Welp, scratch that - the test still fails. But at least it fails equally on all operating systems now. Still can't reproduce locally, though :/

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Dec 22, 2023

Tests pass, Gotcha!

@Skn0tt Skn0tt marked this pull request as ready for review December 22, 2023 11:10
@Skn0tt Skn0tt self-assigned this Dec 22, 2023
Copy link
Collaborator

@lukasholzer lukasholzer left a comment

Choose a reason for hiding this comment

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

Looks great just a small comment about a type where I think it should stay optional

src/commands/types.d.ts Outdated Show resolved Hide resolved
src/lib/edge-functions/registry.ts Show resolved Hide resolved
src/lib/functions/registry.ts Show resolved Hide resolved
src/lib/functions/registry.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@lukasholzer lukasholzer left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@Skn0tt Skn0tt merged commit 02e1069 into main Jan 2, 2024
35 checks passed
@Skn0tt Skn0tt deleted the fix-ef-internal-functions branch January 2, 2024 15:19
Skn0tt added a commit that referenced this pull request Feb 13, 2024
Skn0tt added a commit that referenced this pull request Feb 13, 2024
…6381)

* refactor: replace deprecated APIs

* fix: only send request to functions server if form handler is configured

* refactor: replace some more withSiteBuilder calls

* fix: revert POST test to before #6257
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.

2 participants