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

Add ServerInfo struct for node rendering #5018

Merged
merged 1 commit into from
May 18, 2023
Merged

Conversation

jridgewell
Copy link
Contributor

Description

This adds a new serializable helper struct for Turbopack's server information (hostname, ip, port, protocol).

Testing Instructions

None

Re: WEB-1064

@jridgewell jridgewell requested a review from a team as a code owner May 18, 2023 18:31
@vercel
Copy link

vercel bot commented May 18, 2023

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

Name Status Preview Updated (UTC)
turbo-site ✅ Ready (Inspect) Visit Preview May 18, 2023 6:32pm
10 Ignored Deployments
Name Status Preview Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-cra-web ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-designsystem-docs ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-gatsby-web ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-native-web ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-nonmonorepo ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-svelte-web ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-tailwind-web ⬜️ Ignored (Inspect) May 18, 2023 6:32pm
examples-vite-web ⬜️ Ignored (Inspect) May 18, 2023 6:32pm

@github-actions
Copy link
Contributor

✅ This change can build next-swc

jridgewell added a commit to vercel/next.js that referenced this pull request May 18, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 18, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

@github-actions
Copy link
Contributor

Linux Benchmark for f410295

Test Base PR % Significant %
bench_startup/Turbopack CSR/1000 modules 873.12ms ± 2.84ms 895.61ms ± 8.04ms +2.58% +0.08%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 8529.89µs ± 38.09µs 8553.97µs ± 28.31µs +0.28%
bench_hmr_to_eval/Turbopack CSR/1000 modules 7554.06µs ± 37.31µs 7742.38µs ± 246.59µs +2.49%
bench_startup/Turbopack CSR/1000 modules 873.12ms ± 2.84ms 895.61ms ± 8.04ms +2.58% +0.08%

Copy link
Contributor

@kwonoj kwonoj left a comment

Choose a reason for hiding this comment

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

Curious if there are existing struct around one of our deps 🤔

@github-actions
Copy link
Contributor

MacOS Benchmark for f410295

Test Base PR % Significant %
bench_hmr_to_eval/Turbopack CSR/1000 modules 51.47ms ± 4.05ms 24.92ms ± 0.25ms -51.59% -41.38%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 24.39ms ± 0.59ms 26.31ms ± 0.71ms +7.88%
bench_hmr_to_eval/Turbopack CSR/1000 modules 51.47ms ± 4.05ms 24.92ms ± 0.25ms -51.59% -41.38%
bench_startup/Turbopack CSR/1000 modules 2750.49ms ± 43.58ms 2793.24ms ± 58.00ms +1.55%

@jridgewell jridgewell merged commit 0e22bda into main May 18, 2023
42 of 44 checks passed
@jridgewell jridgewell deleted the jrl-forwarded-proxy branch May 18, 2023 21:07
jridgewell added a commit to vercel/next.js that referenced this pull request May 18, 2023
ijjk pushed a commit to vercel/next.js that referenced this pull request May 19, 2023
This PR forwards the [new
`ServerInfo`](vercel/turbo#5018) struct to
Turbopack's rendering processes, allowing it to initialize the
requesting headers with the `x-forwarded-*` headers. These headers, and
`x-forwarded-proto` in particular, are necessary for [NextAuth to
work](https://github.com/nextauthjs/next-auth/blob/f62c0167/packages/next-auth/src/core/index.ts#L73-L76).

These headers are initialized in the non-turbo server via
[`http-proxy`](https://github.com/http-party/node-http-proxy/blob/9b96cd72/lib/http-proxy/passes/web-incoming.js#L58-L86).

Fixes WEB-1064
hydRAnger pushed a commit to hydRAnger/next.js that referenced this pull request Jun 12, 2023
This PR forwards the [new
`ServerInfo`](vercel/turbo#5018) struct to
Turbopack's rendering processes, allowing it to initialize the
requesting headers with the `x-forwarded-*` headers. These headers, and
`x-forwarded-proto` in particular, are necessary for [NextAuth to
work](https://github.com/nextauthjs/next-auth/blob/f62c0167/packages/next-auth/src/core/index.ts#L73-L76).

These headers are initialized in the non-turbo server via
[`http-proxy`](https://github.com/http-party/node-http-proxy/blob/9b96cd72/lib/http-proxy/passes/web-incoming.js#L58-L86).

Fixes WEB-1064
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