question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot set property urlNormalized of #<Object> which has only a getter

See original GitHub issue

I’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:closed
  • Created 2 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
brilloutcommented, Nov 2, 2021

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 mutate pageContext directly.

1reaction
brilloutcommented, Oct 18, 2021

I see that makes sense. I’ll have a look and release a fix tentatively today.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found