Closed
Description
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