Cannot set property body of #<Request> ServiceStackClient

Hi

I am getting the following error, it just happened randomly without any new code deployments and now we can’t use the application:

TypeError: Cannot set property body of # which has only a getter
at t.createRequest (index.js:648:1)
at t.sendRequest (index.js:744:1)
at t.send (index.js:729:1)
at t.postToUrl (index.js:574:1)
at a.getRoles (App.vue:599:1)
at App.vue:307:1

Please assist.

You can set Request.body, e.g. this works in Chrome:

var req = new Request("https://google.com",  { method: "GET" })
req.body = JSON.stringify({ a: 1 })

What JS runtime is throwing this error?

This is happening in Chrome.

I’m running it in the latest version of Chrome without issue, can you run the snippet above in Chrome’s Web Inspector console?

You can also try running the actual library itself in any ServiceStack App by using its embedded @servicestack/client library, e.g. you can go in the empty web template hosted at https://web.web-templates.io and creating a new client and sending a request in the JS Console:

var client = new JsonServiceClient("https://web.web-templates.io")
await client.get(new Hello({ Name: "Test" }))

Does both work in your Chrome browser version?

Yes, both of these work.

How can I fix my issue? Is it maybe the webpack with Vue 2, that is causing the issue?

No idea, check your source control and revert any changes, config or new deps that may be causing it. From the exception it appears something is modifying the browsers built-in fetch function.

Having same issue, works only in FF. Other browsers are showing same error (tested on multiple PCs).
This behavior is on old react project using servicestack-client (not @servicestack/client)

I’m assuming a fetch shim that replaces the browsers built-in fetch is causing it.

I’m guessing that something has changed along with browsers update.

Project is in production for a while now, and there were no changes on release for at least a year, and then a week or two ago client called saying that he cannot login trough Edge. Few days later other client called saying that he is having same issue, only with Chrome. I have reproduced the same behavior with Opera, and basically all chromium based browsers appears to produce this issue. I tried to find some changelog about this without luck.
So far our clients are managing themselves with Firefox.

@rudolphk have you managed to solve this issue?

Hi @masterit, no I haven’t. My clients is currently working using Firefox as a workaround. Any luck on your side?

Same here.
I’ve tried to update everything to lastest versions but there are too many breaking changes in all dependencies in between and I gave up.

I’m hoping that this is newly introduced bug in chromium engine, but it’s a long shot :slight_smile:
Just disabled autoupdate on Firefox and hoping for problem to solve itself.

What I don’t understand, if I do the tests above in Chrome it does work. So not sure where the issue is coming in? I’ve updated my project to the latest version of the library, so not sure if there is something in webpack that creates a breaking shim of some sort.

@rudolphk
I’m pretty sure that this is caused with browser update - another project that is in production and untouched for at least a year started showing this issue recently with all clients as their browsers were updating.

While writting this I’m on Opera v90 and this untouched project works. I’ve updated Opera right now to latest v91 and it stopped working, so I’m guessing that it got to be some Chromium engine change.
I tried but could not find anything in their changelog that would gave me any lead what to do.