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

URL containing space fails to be fetched during prerender phase #27590

Closed
1 task
lukasmatta opened this issue May 3, 2024 · 1 comment · Fixed by #27592
Closed
1 task

URL containing space fails to be fetched during prerender phase #27590

lukasmatta opened this issue May 3, 2024 · 1 comment · Fixed by #27592
Assignees

Comments

@lukasmatta
Copy link
Contributor

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When there is a URL containing space being fetched, it fails during prerendering. Encoding space in the URL to be %20 doesn't help. I've tried it with both withFetch() and without it when providing HttpClient.

Minimal Reproduction

https://github.com/lukasmatta/prerenderingproblem

Run npm install then run npm build.

Exception or Error

ERROR TypeError: Failed to parse URL from /assets/Folder%20space/test.txt
    at node:internal/deps/undici/undici:12618:11
    at a.invoke (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:3:6639)
    at Object.onInvoke (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/chunk-I5RKM5LS.mjs:34:17372)
    at a.invoke (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:3:6579)
    at p.run (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:3:1965)
    at file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:4:577
    at a.invokeTask (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:3:7265)
    at Object.onInvokeTask (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/chunk-I5RKM5LS.mjs:34:17188)
    at a.invokeTask (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:3:7186)
    at p.runTask (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:3:2577) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:405:5)
      at new URL (node:internal/url:676:13)
      at new Request (node:internal/deps/undici/undici:6108:25)
      at fetch (node:internal/deps/undici/undici:10396:25)
      at Object.fetch (node:internal/deps/undici/undici:12617:10)
      at fetch (node:internal/process/pre_execution:281:25)
      at patchedFetch (//PrerenderSpaceUrl/node_modules/@angular-devkit/build-angular/src/utils/server-rendering/fetch-patch.js:42:20)
      at file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:4:3273
      at l.<computed> (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/polyfills.server.mjs:3:12973)
      at e.<anonymous> (file:////PrerenderSpaceUrl/.angular/prerender-root/2bfae38a-22b4-47d1-9c2c-0681f0ed977a/chunk-I5RKM5LS.mjs:35:13916) {
    input: '/assets/Folder%20space/test.txt',
    code: 'ERR_INVALID_URL'
  }
}

Your Environment

Angular CLI: 17.3.6
Node: 18.20.1
Package Manager: npm 10.5.0
OS: darwin arm64

Angular: 17.3.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.6
@angular-devkit/build-angular   17.3.6
@angular-devkit/core            17.3.6
@angular-devkit/schematics      17.3.6
@angular/cli                    17.3.6
@angular/ssr                    17.3.6
@schematics/angular             17.3.6
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.5

Anything else relevant?

No response

@alan-agius4 alan-agius4 self-assigned this May 3, 2024
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 3, 2024
Previously, missing URL decoding led to assets not being located correctly.

Closes: angular#27590
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 3, 2024
Previously, missing URL decoding led to assets not being located correctly.

Closes: angular#27590
alan-agius4 added a commit that referenced this issue May 3, 2024
Previously, missing URL decoding led to assets not being located correctly.

Closes: #27590
alan-agius4 added a commit that referenced this issue May 3, 2024
Previously, missing URL decoding led to assets not being located correctly.

Closes: #27590
(cherry picked from commit 5f14787)
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 3, 2024
…ng SSG fetch

Previously, missing URL decoding led to assets not being located correctly.

Closes: angular#27590
(cherry picked from commit 5f14787)
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 3, 2024
…ng SSG fetch

Previously, missing URL decoding led to assets not being located correctly.

Closes: angular#27590
(cherry picked from commit 5f14787)
clydin pushed a commit that referenced this issue May 3, 2024
…ng SSG fetch

Previously, missing URL decoding led to assets not being located correctly.

Closes: #27590
(cherry picked from commit 5f14787)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants