TypeError: Cannot set property urlNormalized of #<Object> which has only a getter
See original GitHub issueI’ve upgraded from 0.3.4 to 0.3.12 today and I’m encountering the issue below when I issue this command
EDIT: After testing with previous releases, The error appears from the release 0.3.11
vite build && vite build --ssr && vite-plugin-ssr prerender
# Build and build SSR both succeed...
vite-plugin-ssr 0.3.12 pre-rendering HTML...
/Users/stouffi/projects/Libertrip/viteuf/.yarn/__virtual__/vite-plugin-ssr-virtual-53aa919ee5/0/cache/vite-plugin-ssr-npm-0.3.12-0b9c9a4d63-dae87df8f3.zip/node_modules/vite-plugin-ssr/dist/cjs/node/cli/bin.js:30
throw rejectValue;
^
TypeError: Cannot set property urlNormalized of #<Object> which has only a getter
at Function.assign (<anonymous>)
at executeOnBeforeRenderHooks (/Users/stouffi/projects/Libertrip/viteuf/.yarn/__virtual__/vite-plugin-ssr-virtual-53aa919ee5/0/cache/vite-plugin-ssr-npm-0.3.12-0b9c9a4d63-dae87df8f3.zip/node_modules/vite-plugin-ssr/dist/cjs/node/renderPage.js:438:16)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async prerenderPage (/Users/stouffi/projects/Libertrip/viteuf/.yarn/__virtual__/vite-plugin-ssr-virtual-53aa919ee5/0/cache/vite-plugin-ssr-npm-0.3.12-0b9c9a4d63-dae87df8f3.zip/node_modules/vite-plugin-ssr/dist/cjs/node/renderPage.js:242:5)
at async /Users/stouffi/projects/Libertrip/viteuf/.yarn/__virtual__/vite-plugin-ssr-virtual-53aa919ee5/0/cache/vite-plugin-ssr-npm-0.3.12-0b9c9a4d63-dae87df8f3.zip/node_modules/vite-plugin-ssr/dist/cjs/node/prerender.js:166:57
I’ve both tested with vite 2.5.10 and 2.6.9 and got the same result.
After a quick search, I’ve found an issue from esbuild with similar error message: https://github.com/evanw/esbuild/issues/587
But I cannot say wether it’s related or not.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Cannot set property getRequest of #<Object> which has only ...
spyOn tries to replace the property with a spy wrapping the original function but can't if the property is defined with only get...
Read more >Cannot set property of #<Object> which has only a getter #587
The specific reason this happens is because assigning a property to an object where the property already exists on the prototype chain will ......
Read more >TypeError: setting getter-only property "x" - JavaScript | MDN
The JavaScript strict mode-only exception "setting getter-only property" occurs when there is an attempt to set a new value to a property for...
Read more >TypeError: Cannot set Property which has only a Getter in JS
The "Cannot set property which has only a getter" error occurs when trying to set a new value to a property, for which...
Read more >Cannot set property data of #<Object> which has only a getter
going on? TypeError: Cannot set property data of #<Object> which has only a getter at Object.merge (/usr/local/lib/node/.npm/connect/1.0.3/package/
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve some bigger plans regarding
pageContext
handling that includes improve clear & helpful error messages about “wrong”pageContext
handling, i.e. you are not suppose to mutatepageContext
directly.I see that makes sense. I’ll have a look and release a fix tentatively today.