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(repo): Handle errors in E2E proxy server #5328

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

jacekradko
Copy link
Member

@jacekradko jacekradko commented Mar 11, 2025

Description

Long story short... crashing the proxy server is bad.

Long story long...

Background

Our integration tests run against app servers using Next.js in dev mode, meaning Hot Module Replacement (HMR) is enabled. In some tests, we route traffic through a proxy server, which unexpectedly crashed when handling the /_next/webpack-hmr route.

Why? Because our proxy server wasn’t handling errors properly.

What Changed?

  • Implemented error handling in the proxy server to prevent crashes.
  • This issue started suddenly, likely because we always install the latest version of each Next.js major release in our test matrix.
  • Suspicious Timing? Next.js v15.2.2 was released today, and it seems like the HMR route behavior changed. Coincidence? I think not.

Open Questions

  • Should we be running Next.js in dev mode during tests?
  • Should we pin Next.js versions instead of always using the latest major release?

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

vercel bot commented Mar 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2025 1:10am

Copy link

changeset-bot bot commented Mar 12, 2025

⚠️ No Changeset found

Latest commit: 3c11956

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jacekradko jacekradko force-pushed the fix/random-e2e-failures branch from 8c07b3a to 3c11956 Compare March 12, 2025 01:09
@jacekradko jacekradko marked this pull request as ready for review March 12, 2025 01:10
@jacekradko jacekradko changed the title fix(repo): random e2e failures fix(repo): Handle errors in E2E proxy server Mar 12, 2025
@LekoArts
Copy link
Member

Should we be running Next.js in dev mode during tests?

If the test assertions require it, then yes. If it can be either I personally (in my own projects) prefer to use the build + serve option as it's faster, more stable/reliable, and ensures that it works in "production". Sometimes there are differences between dev and build behavior and I rather test against what is shown live.
But sometimes I have to test functionality that is only relevant during dev, so I use dev in those instances.

Should we pin Next.js versions instead of always using the latest major release?

Keeping us auto-updated is a good thing as we can react to (un)intended changes that might break something on our end. As a user I expect it to always work with the latest version of Next.js so we should test this. And us having to manually updated pinned versions (even with bots) won't work, we'll forget it.

@jacekradko jacekradko merged commit 1dbd08c into main Mar 12, 2025
45 of 46 checks passed
@jacekradko jacekradko deleted the fix/random-e2e-failures branch March 12, 2025 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants