Skip to content

Create valid URLs in source map sources with Turbopack#75719

Closed
eps1lon wants to merge 9 commits intocanaryfrom
sebbie/02-05-valid_url_host_turbopack
Closed

Create valid URLs in source map sources with Turbopack#75719
eps1lon wants to merge 9 commits intocanaryfrom
sebbie/02-05-valid_url_host_turbopack

Conversation

@eps1lon
Copy link
Member

@eps1lon eps1lon commented Feb 5, 2025

turbopack://[project]/ -> turbopack:///[project]/
turbopack://[turbopack] -> turbopack:///[turbopack]/
turbopack://[next] -> turbopack:///[next]/ (don't actually know where this is coming from).

Entries in sources of a sourcemaps need to be valid relative or absolute URLs. The part after the protocol is considered the "host". If a host is encapsulated by square brackets, it is treated as an IPv6. That means that URLs like turbopack://[project] are not valid since project is not a valid IPv6.

Source map consumers are free to ignore invalid source URLs. However, it's also valid by spec for them to throw. Both Node.js and source-map choose to throw while Chrome simply ignores the URL.

So we need to make an effort to create valid URLs. Sourcemaps from 3rd party libraries can still be invalid which we handle since #75713.

I originally used [project] -> PROJECT but then some places used the lowercase variant. This also meant we produced TURBOPACK_runtime.js. This seems sketchy to debug between case-sensitive (e.g. Ubuntu) and case-insensitive file systems (e.g. MacOS).

<project> and |project| don't produce valid URLs either. %project% could work but I don't really trust this on Windows which could interpret it as a placeholder. No round brackets because (project) ends up in function names which Chrome has problems parsing in stackframes. {project} could work but curly braces are also unsafe characters and may need to be escaped. $ is a safe character but breaks resolution of Client references in React (don't know if intentional). ~ doesn't require any encoding.

Just using project seems like a nightmare to grep in the future.

I mainly did pattern matching. I probably need some guidance for places I missed.

Closes https://linear.app/vercel/issue/NDX-795/

Copy link
Member Author

eps1lon commented Feb 5, 2025

@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch from 8749b6d to a2fc316 Compare February 6, 2025 21:41
@eps1lon eps1lon force-pushed the sebbie/02-05-handle_invalid_sourcemaps branch from f8960c2 to b883440 Compare February 6, 2025 21:41
@eps1lon eps1lon changed the title Hit case where turbopack:// URLs are in sources Create valid URLs in source map sources with Turbopack Feb 6, 2025
@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch from a2fc316 to 918eb1a Compare February 6, 2025 21:58
@eps1lon eps1lon force-pushed the sebbie/02-05-handle_invalid_sourcemaps branch 2 times, most recently from 5ec9f44 to fe356cf Compare February 6, 2025 22:17
@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch from 918eb1a to 8000180 Compare February 6, 2025 22:17
@ijjk
Copy link
Member

ijjk commented Feb 6, 2025

Stats from current PR

Default Build (Increase detected ⚠️)
General
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
buildDuration 20.9s 18.3s N/A
buildDurationCached 17.5s 14.6s N/A
nodeModulesSize 393 MB 393 MB N/A
nextStartRea..uration (ms) 450ms 457ms N/A
Client Bundles (main, webpack)
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
5271-HASH.js gzip 55.4 kB 55.4 kB N/A
6228c9d4-HASH.js gzip 56.9 kB 56.9 kB N/A
7048.HASH.js gzip 168 B 168 B
8377-HASH.js gzip 5.46 kB 5.46 kB N/A
framework-HASH.js gzip 57.5 kB 57.5 kB N/A
main-app-HASH.js gzip 245 B 246 B N/A
main-HASH.js gzip 34.9 kB 34.9 kB N/A
webpack-HASH.js gzip 1.71 kB 1.71 kB
Overall change 1.88 kB 1.88 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Overall change 39.4 kB 39.4 kB
Client Pages
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
_app-HASH.js gzip 194 B 194 B
_error-HASH.js gzip 193 B 192 B N/A
amp-HASH.js gzip 513 B 511 B N/A
css-HASH.js gzip 342 B 342 B
dynamic-HASH.js gzip 1.84 kB 1.84 kB N/A
edge-ssr-HASH.js gzip 265 B 264 B N/A
head-HASH.js gzip 363 B 360 B N/A
hooks-HASH.js gzip 393 B 390 B N/A
image-HASH.js gzip 4.59 kB 4.59 kB N/A
index-HASH.js gzip 268 B 266 B N/A
link-HASH.js gzip 2.35 kB 2.35 kB
routerDirect..HASH.js gzip 328 B 326 B N/A
script-HASH.js gzip 397 B 397 B
withRouter-HASH.js gzip 325 B 325 B
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 3.72 kB 3.72 kB
Client Build Manifests
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
_buildManifest.js gzip 749 B 747 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
index.html gzip 523 B 523 B
link.html gzip 538 B 537 B N/A
withRouter.html gzip 519 B 518 B N/A
Overall change 523 B 523 B
Edge SSR bundle Size
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
edge-ssr.js gzip 130 kB 130 kB N/A
page.js gzip 214 kB 214 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
middleware-b..fest.js gzip 677 B 674 B N/A
middleware-r..fest.js gzip 155 B 156 B N/A
middleware.js gzip 31.6 kB 31.6 kB N/A
edge-runtime..pack.js gzip 844 B 844 B
Overall change 844 B 844 B
Next Runtimes
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
app-page-exp...dev.js gzip 395 kB 395 kB
app-page-exp..prod.js gzip 133 kB 133 kB
app-page-tur..prod.js gzip 145 kB 145 kB
app-page-tur..prod.js gzip 141 kB 141 kB
app-page.run...dev.js gzip 382 kB 382 kB
app-page.run..prod.js gzip 129 kB 129 kB
app-route-ex...dev.js gzip 39.4 kB 39.4 kB
app-route-ex..prod.js gzip 25.7 kB 25.7 kB
app-route-tu..prod.js gzip 25.7 kB 25.7 kB
app-route-tu..prod.js gzip 25.5 kB 25.5 kB
app-route.ru...dev.js gzip 41 kB 41 kB
app-route.ru..prod.js gzip 25.5 kB 25.5 kB
dist_client_...dev.js gzip 356 B 356 B
dist_client_...dev.js gzip 349 B 349 B
pages-api-tu..prod.js gzip 9.72 kB 9.72 kB
pages-api.ru...dev.js gzip 11.8 kB 11.8 kB
pages-api.ru..prod.js gzip 9.72 kB 9.72 kB
pages-turbo...prod.js gzip 22 kB 22 kB
pages.runtim...dev.js gzip 31.6 kB 31.6 kB
pages.runtim..prod.js gzip 22 kB 22 kB
server.runti..prod.js gzip 61.2 kB 61.2 kB
Overall change 1.68 MB 1.68 MB
build cache Overall increase ⚠️
vercel/next.js canary vercel/next.js sebbie/02-05-valid_url_host_turbopack Change
0.pack gzip 2.12 MB 2.12 MB ⚠️ +2.87 kB
index.pack gzip 77.5 kB 75.8 kB N/A
Overall change 2.12 MB 2.12 MB ⚠️ +2.87 kB
Diff details
Diff for 5271-HASH.js

Diff too large to display

Diff for main-HASH.js

Diff too large to display

Commit: 176169f

@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch from 8000180 to 5cdd87a Compare February 6, 2025 22:48
@eps1lon eps1lon changed the base branch from sebbie/02-05-handle_invalid_sourcemaps to graphite-base/75719 February 6, 2025 23:14
@eps1lon eps1lon force-pushed the graphite-base/75719 branch from fe356cf to 36685d8 Compare February 7, 2025 17:36
@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch from e0938af to d34bdc0 Compare February 7, 2025 17:36
@eps1lon eps1lon force-pushed the graphite-base/75719 branch from 36685d8 to c003181 Compare February 9, 2025 13:04
@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch from d34bdc0 to 221167b Compare February 9, 2025 13:04
@eps1lon eps1lon changed the base branch from graphite-base/75719 to canary February 9, 2025 13:05
@ijjk
Copy link
Member

ijjk commented Feb 9, 2025

Failing test suites

Commit: 176169f

pnpm test test/integration/css-minify/test/index.test.js (turbopack)

  • css-minify > production mode > should minify correctly by removing whitespace
Expand output

● css-minify › production mode › should minify correctly by removing whitespace

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `css-minify production mode should minify correctly by removing whitespace 1`

- Snapshot  - 1
+ Received  + 1

  /* /[project]/test/integration/css-minify/styles/global.css [client] (css) */
  .a{--var-1:0;--var-2:0;--var-1:-50%;--var-2:-50%}.b{--var-1:0;--var-2:0;--var-2:-50%}

- /*# sourceMappingURL=test_integration_css-minify_styles_global_07fb6d.css.map*/
+ /*# sourceMappingURL=test_integration_css-minify_styles_global_f83b81.css.map*/
  ↵

  22 |     const css = await renderViaHTTP(appPort, href)
  23 |     if (process.env.TURBOPACK) {
> 24 |       expect(css).toMatchInlineSnapshot(`
     |                   ^
  25 |         "/* /[project]/test/integration/css-minify/styles/global.css [client] (css) */
  26 |         .a{--var-1:0;--var-2:0;--var-1:-50%;--var-2:-50%}.b{--var-1:0;--var-2:0;--var-2:-50%}
  27 |

  at Object.toMatchInlineSnapshot (integration/css-minify/test/index.test.js:24:19)

Read more about building and testing Next.js in contributing.md.

pnpm test-start test/production/app-dir/metadata-img-too-large/twitter-image/index.test.ts

  • app-dir - metadata-img-too-large twitter-image > should throw when twitter-image file size exceeds 5MB
Expand output

● app-dir - metadata-img-too-large twitter-image › should throw when twitter-image file size exceeds 5MB

expect(received).toMatch(expected)

Expected pattern: /Error: File size for Twitter image "\[project\]\/app\/twitter-image\.png" exceeds 5MB/
Received string:  "   Loading config from /tmp/next-install-20e4c46e3ccd88273f486924ffa7c1d2cb45abcc8bf4dc64de9e27743a79225b/next.config.js
   Loading config from /tmp/next-install-20e4c46e3ccd88273f486924ffa7c1d2cb45abcc8bf4dc64de9e27743a79225b/next.config.js
   ▲ Next.js 15.2.0-canary.60 (Turbopack)·
   Creating an optimized production build ...
   Loading config from /tmp/next-install-20e4c46e3ccd88273f486924ffa7c1d2cb45abcc8bf4dc64de9e27743a79225b/next.config.js
   Loading config from /tmp/next-install-20e4c46e3ccd88273f486924ffa7c1d2cb45abcc8bf4dc64de9e27743a79225b/next.config.js
   Building (0/4) ...
   Building (1/4)··
   Building (2/4)··
   Building (3/4)··
 ✓ Building (4/4)
 ✓ Compiled successfully in 1181ms
   Linting and checking validity of types ...·
   We detected TypeScript in your project and created a tsconfig.json file for you.
   Collecting page data ...
Error: File size for Twitter image \"/[project]/app/twitter-image.png\" exceeds 5MB. (Current: 6.86MB)
Read more: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#image-files-jpg-png-gif

  at 51494 (../.next/server/chunks/_[root of the server]__7c5c73._.js:13:9606935)
  at instantiateModule (../.next/server/chunks/_[turbopack]_runtime.js:590:23)
  at getOrInstantiateModuleFromParent (../.next/server/chunks/_[turbopack]_runtime.js:645:12)
  at esmImport (../.next/server/chunks/_[turbopack]_runtime.js:132:20)
  at 41996 (../.next/server/chunks/_[root of the server]__7c5c73._.js:14:490)
  at instantiateModule (../.next/server/chunks/_[turbopack]_runtime.js:590:23)
  at instantiateRuntimeModule (../.next/server/chunks/_[turbopack]_runtime.js:653:12)
  at Object.getOrInstantiateRuntimeModule (../.next/server/chunks/_[turbopack]_runtime.js:669:12)
  at Object.<anonymous> (../.next/server/app/twitter-image.png/route.js:7:26)·
  > Build error occurred
  [Error: Failed to collect page data for /twitter-image.png] {
    type: 'Error'
  }
  "
  at Object.toMatch (production/app-dir/metadata-img-too-large/twitter-image/index.test.ts:21:28)

Read more about building and testing Next.js in contributing.md.

pnpm test test/integration/script-loader/test/index.test.js (turbopack)

  • Next.js Script - Primary Strategies - Strict Mode > priority beforeInteractive
  • Next.js Script - Primary Strategies - Strict Mode > priority beforeInteractive - older version
Expand output

● Next.js Script - Primary Strategies - Strict Mode › priority beforeInteractive

expect(received).toBeGreaterThan(expected)

Expected: > 0
Received:   0

  121 |             `#${id} ~ script[src^="/_next/static/chunks/%5Broot%20of%20the%20server%5D__"]`
  122 |           ).length
> 123 |         ).toBeGreaterThan(0)
      |           ^
  124 |       } else {
  125 |         expect(
  126 |           $(`#${id} ~ script[src^="/_next/static/chunks/main"]`).length

  at toBeGreaterThan (integration/script-loader/test/index.test.js:123:11)
  at Object.test (integration/script-loader/test/index.test.js:131:5)

● Next.js Script - Primary Strategies - Strict Mode › priority beforeInteractive - older version

expect(received).toBeGreaterThan(expected)

Expected: > 0
Received:   0

  151 |             `#${id} ~ script[src^="/_next/static/chunks/%5Broot%20of%20the%20server%5D__"]`
  152 |           ).length
> 153 |         ).toBeGreaterThan(0)
      |           ^
  154 |       } else {
  155 |         expect(
  156 |           $(`#${id} ~ script[src^="/_next/static/chunks/main"]`).length

  at toBeGreaterThan (integration/script-loader/test/index.test.js:153:11)
  at Object.test (integration/script-loader/test/index.test.js:161:5)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/scss/compilation-and-prefixing/compilation-and-prefixing.test.ts (turbopack)

  • SCSS Support ({"sass": "1.54.0"}) > Production only > CSS Compilation and Prefixing > should've compiled and prefixed
  • SCSS Support ({"sass-embedded": "1.75.0"}) > Production only > CSS Compilation and Prefixing > should've compiled and prefixed
Expand output

● SCSS Support ({"sass": "1.54.0"}) › Production only › CSS Compilation and Prefixing › should've compiled and prefixed

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `SCSS Support ({"sass": "1.54.0"}) Production only CSS Compilation and Prefixing should've compiled and prefixed 2`

- Snapshot  - 1
+ Received  + 1

@@ -3,11 +3,11 @@
      {
        "map": {
          "mappings": "AAAA,iCAAiC",
          "names": [],
          "sources": [
-           "turbopack:///[project]/styles/global.scss.css",
+           "turbopack://[project]/styles/global.scss.css",
          ],
          "sourcesContent": [
            ".redText ::placeholder{color:red}.flex-parsing{flex:0 0 calc(50% - var(--vertical-gutter))}",
          ],
          "version": 3,

  87 |         if (process.env.TURBOPACK) {
  88 |           if (dependencies.sass) {
> 89 |             expect(sourceMapContentParsed).toMatchInlineSnapshot(`
     |                                            ^
  90 |               {
  91 |                 "sections": [
  92 |                   {

  at Object.toMatchInlineSnapshot (e2e/app-dir/scss/compilation-and-prefixing/compilation-and-prefixing.test.ts:89:44)

● SCSS Support ({"sass-embedded": "1.75.0"}) › Production only › CSS Compilation and Prefixing › should've compiled and prefixed

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `SCSS Support ({"sass-embedded": "1.75.0"}) Production only CSS Compilation and Prefixing should've compiled and prefixed 2`

- Snapshot  - 1
+ Received  + 1

@@ -3,11 +3,11 @@
      {
        "map": {
          "mappings": "AAAA,iCAAiC",
          "names": [],
          "sources": [
-           "turbopack:///[project]/styles/global.scss.css",
+           "turbopack://[project]/styles/global.scss.css",
          ],
          "sourcesContent": [
            ".redText ::placeholder{color:red}.flex-parsing{flex:0 0 calc(50% - var(--vertical-gutter))}",
          ],
          "version": 3,

  124 |             `)
  125 |           } else {
> 126 |             expect(sourceMapContentParsed).toMatchInlineSnapshot(`
      |                                            ^
  127 |               {
  128 |                 "sections": [
  129 |                   {

  at Object.toMatchInlineSnapshot (e2e/app-dir/scss/compilation-and-prefixing/compilation-and-prefixing.test.ts:126:44)

Read more about building and testing Next.js in contributing.md.

pnpm test-dev-turbo test/development/basic/next-dynamic/next-dynamic-base-path.test.ts (turbopack)

  • next/dynamic > Dynamic import > default behavior > should render dynamic import components
  • next/dynamic > Dynamic import > default behavior > should render dynamic import components using a function as first parameter
Expand output

● next/dynamic › Dynamic import › default behavior › should render dynamic import components

expect(received).toContain(expected) // indexOf

Expected value: "[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)"
Received array: ["/[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)"]

  66 |         const $ = await get$(basePath + '/dynamic/ssr')
  67 |         // Make sure the client side knows it has to wait for the bundle
> 68 |         expect(JSON.parse($('#__NEXT_DATA__').html()).dynamicIds).toContain(
     |                                                                   ^
  69 |           process.env.TURBOPACK
  70 |             ? '[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)'
  71 |             : 'pages/dynamic/ssr.js -> ../../components/hello1'

  at Object.toContain (development/basic/next-dynamic/next-dynamic.test.ts:68:67)

● next/dynamic › Dynamic import › default behavior › should render dynamic import components using a function as first parameter

expect(received).toContain(expected) // indexOf

Expected value: "[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)"
Received array: ["/[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)"]

  77 |         const $ = await get$(basePath + '/dynamic/function')
  78 |         // Make sure the client side knows it has to wait for the bundle
> 79 |         expect(JSON.parse($('#__NEXT_DATA__').html()).dynamicIds).toContain(
     |                                                                   ^
  80 |           process.env.TURBOPACK
  81 |             ? '[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)'
  82 |             : 'pages/dynamic/function.js -> ../../components/hello1'

  at Object.toContain (development/basic/next-dynamic/next-dynamic.test.ts:79:67)

Read more about building and testing Next.js in contributing.md.

pnpm test-dev-turbo test/development/sass-error/index.test.ts (turbopack)

  • app dir - css > sass support > error handling > should use original source points for sass errors
Expand output

● app dir - css › sass support › error handling › should use original source points for sass errors

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `app dir - css sass support error handling should use original source points for sass errors 1`

- Snapshot  - 1
+ Received  + 1

@@ -6,6 +6,6 @@
       | ^
    46 |   fill: currentColor;
    47 | }
    48 |

- Pseudo-elements like '::before' or '::after' can't be followed by selectors like 'Ident("path")' at [project]/app/global.scss.css:0:884"
+ Pseudo-elements like '::before' or '::after' can't be followed by selectors like 'Ident("path")' at /[project]/app/global.scss.css:0:884"

  26 |
  27 |           // css-loader does not report an error for this case
> 28 |           expect(source).toMatchInlineSnapshot(`
     |                          ^
  29 |            "./app/global.scss.css (45:1)
  30 |            Parsing css source code failed
  31 |              43 | }

  at Object.toMatchInlineSnapshot (development/sass-error/index.test.ts:28:26)

Read more about building and testing Next.js in contributing.md.

pnpm test-dev-turbo test/development/basic/next-dynamic/next-dynamic.test.ts (turbopack)

  • next/dynamic > Dynamic import > default behavior > should render dynamic import components
  • next/dynamic > Dynamic import > default behavior > should render dynamic import components using a function as first parameter
Expand output

● next/dynamic › Dynamic import › default behavior › should render dynamic import components

expect(received).toContain(expected) // indexOf

Expected value: "[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)"
Received array: ["/[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)"]

  66 |         const $ = await get$(basePath + '/dynamic/ssr')
  67 |         // Make sure the client side knows it has to wait for the bundle
> 68 |         expect(JSON.parse($('#__NEXT_DATA__').html()).dynamicIds).toContain(
     |                                                                   ^
  69 |           process.env.TURBOPACK
  70 |             ? '[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)'
  71 |             : 'pages/dynamic/ssr.js -> ../../components/hello1'

  at Object.toContain (development/basic/next-dynamic/next-dynamic.test.ts:68:67)

● next/dynamic › Dynamic import › default behavior › should render dynamic import components using a function as first parameter

expect(received).toContain(expected) // indexOf

Expected value: "[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)"
Received array: ["/[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)"]

  77 |         const $ = await get$(basePath + '/dynamic/function')
  78 |         // Make sure the client side knows it has to wait for the bundle
> 79 |         expect(JSON.parse($('#__NEXT_DATA__').html()).dynamicIds).toContain(
     |                                                                   ^
  80 |           process.env.TURBOPACK
  81 |             ? '[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)'
  82 |             : 'pages/dynamic/function.js -> ../../components/hello1'

  at Object.toContain (development/basic/next-dynamic/next-dynamic.test.ts:79:67)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/production/app-dir/metadata-img-too-large/opengraph-image/index.test.ts (turbopack)

  • app-dir - metadata-img-too-large opengraph-image > should throw when opengraph-image file size exceeds 8MB
Expand output

● app-dir - metadata-img-too-large opengraph-image › should throw when opengraph-image file size exceeds 8MB

expect(received).toMatch(expected)

Expected pattern: /Error: File size for Open Graph image "\[project\]\/app\/opengraph-image\.png" exceeds 8MB/
Received string:  "   Loading config from /tmp/next-install-aad120e660ea69a329548e4a55c5a029eacfb9678b0073bf3983b5bf2f52eff3/next.config.js
   Loading config from /tmp/next-install-aad120e660ea69a329548e4a55c5a029eacfb9678b0073bf3983b5bf2f52eff3/next.config.js
   ▲ Next.js 15.2.0-canary.60 (Turbopack)·
   Creating an optimized production build ...
   Loading config from /tmp/next-install-aad120e660ea69a329548e4a55c5a029eacfb9678b0073bf3983b5bf2f52eff3/next.config.js
   Loading config from /tmp/next-install-aad120e660ea69a329548e4a55c5a029eacfb9678b0073bf3983b5bf2f52eff3/next.config.js
   Building (0/4) ...
   Building (1/4)··
   Building (2/4)··
   Building (3/4)··
 ✓ Building (4/4)
 ✓ Compiled successfully in 3s
   Linting and checking validity of types ...·
   We detected TypeScript in your project and created a tsconfig.json file for you.
   Collecting page data ...
Error: File size for Open Graph image \"/[project]/app/opengraph-image.png\" exceeds 8MB. (Current: 27.45MB)
Read more: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#image-files-jpg-png-gif

  at 33911 (../.next/server/chunks/_[root of the server]__b0cb1b._.js:13:38388034)
  at instantiateModule (../.next/server/chunks/_[turbopack]_runtime.js:590:23)
  at getOrInstantiateModuleFromParent (../.next/server/chunks/_[turbopack]_runtime.js:645:12)
  at esmImport (../.next/server/chunks/_[turbopack]_runtime.js:132:20)
  at 72537 (../.next/server/chunks/_[root of the server]__b0cb1b._.js:14:490)
  at instantiateModule (../.next/server/chunks/_[turbopack]_runtime.js:590:23)
  at instantiateRuntimeModule (../.next/server/chunks/_[turbopack]_runtime.js:653:12)
  at Object.getOrInstantiateRuntimeModule (../.next/server/chunks/_[turbopack]_runtime.js:669:12)
  at Object.<anonymous> (../.next/server/app/opengraph-image.png/route.js:7:26)·
  > Build error occurred
  [Error: Failed to collect page data for /opengraph-image.png] {
    type: 'Error'
  }
  "
  at Object.toMatch (production/app-dir/metadata-img-too-large/opengraph-image/index.test.ts:21:28)

Read more about building and testing Next.js in contributing.md.

pnpm test-dev test/e2e/app-dir/use-cache-standalone-search-params/use-cache-standalone-search-params.test.ts

  • use-cache-standalone-search-params > when searchParams are used inside of "use cache" > should show an error
Expand output

● use-cache-standalone-search-params › when searchParams are used inside of "use cache" › should show an error

expect(received).toContain(expected) // indexOf

Expected substring: "Error: Route /search-params-used used \"searchParams\" inside \"use cache\". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \"searchParams\" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache

  at Page (../app/search-params-used/page.tsx:8:17)"
  Received string:    "   Loading config from /tmp/next-install-743ca103d51984ec605de92f92bec8f76d34c5e44ceab63d1e11b20706466d88/next.config.js
   ○ Compiling /search-params-used ...
   ✓ Compiled /search-params-used in 625ms
   ⨯ Error: Route /search-params-used used \"searchParams\" inside \"use cache\". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \"searchParams\" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache
  at Page (../file:/tmp/next-install-743ca103d51984ec605de92f92bec8f76d34c5e44ceab63d1e11b20706466d88/app/search-params-used/page.tsx:8:17)
     6 |   searchParams: Promise<{ [key: string]: string | string[] | undefined }>
     7 | }) {
  >  8 |   const param = (await searchParams).foo
       |                 ^
     9 |
    10 |   return <p>param: {param}</p>
    11 | } {
    environmentName: 'Cache',
    digest: '222985665'
  }
   GET /search-params-used?foo=1 500 in 859ms
  "
  at Object.toContain (e2e/app-dir/use-cache-standalone-search-params/use-cache-standalone-search-params.test.ts:58:27)

● use-cache-standalone-search-params › when searchParams are used inside of "use cache" › should show an error

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `use-cache-standalone-search-params when searchParams are used inside of "use cache" should show an error 1`

Snapshot: "app/search-params-used/page.tsx (8:18) @ Page

   6 |   searchParams: Promise<{ [key: string]: string | string[] | undefined }>
   7 | }) {
>  8 |   const param = (await searchParams).foo
     |                  ^
   9 |
  10 |   return <p>param: {param}</p>
  11 | }"
Received: null

  44 |         const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
  45 |
> 46 |         expect(errorSource).toMatchInlineSnapshot(`
     |                             ^
  47 |            "app/search-params-used/page.tsx (8:18) @ Page
  48 |
  49 |               6 |   searchParams: Promise<{ [key: string]: string | string[] | undefined }>

  at Object.toMatchInlineSnapshot (e2e/app-dir/use-cache-standalone-search-params/use-cache-standalone-search-params.test.ts:46:29)

Read more about building and testing Next.js in contributing.md.

@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch 5 times, most recently from c3f6098 to 009bcaa Compare February 9, 2025 18:27
@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch 3 times, most recently from 635be51 to 1aea268 Compare February 9, 2025 22:07
@eps1lon eps1lon requested a review from sokra February 9, 2025 23:08
@eps1lon eps1lon marked this pull request as ready for review February 9, 2025 23:08
@eps1lon
Copy link
Member Author

eps1lon commented Feb 12, 2025

Need to try turbopack:///[project] first.

@eps1lon eps1lon marked this pull request as draft February 12, 2025 05:58
@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch from 1aea268 to bcc6fcf Compare February 13, 2025 20:32
Tilde needs no escaping at all. `+` behaves differently between `encodeURI` and `encodeURIComponent` so we hit some
(test) faults. Might really be just test issue
but it indicates that using `+` would've caused breakage.
@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch 4 times, most recently from fdcbe5b to 1051a0e Compare February 14, 2025 15:33
@eps1lon eps1lon force-pushed the sebbie/02-05-valid_url_host_turbopack branch from 1051a0e to db00a83 Compare February 14, 2025 15:48
@eps1lon
Copy link
Member Author

eps1lon commented Feb 15, 2025

Replacing with #76075

@eps1lon eps1lon closed this Feb 15, 2025
@eps1lon eps1lon deleted the sebbie/02-05-valid_url_host_turbopack branch February 15, 2025 11:25
@github-actions github-actions bot added the locked label Mar 1, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

created-by: Next.js team PRs by the Next.js team. locked tests Turbopack Related to Turbopack with Next.js. type: next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants