RESOLVED FIXED 203617
"ReadableStream uploading is not supported" when fetch()ing a Request that has been logged to console
https://bugs.webkit.org/show_bug.cgi?id=203617
Summary "ReadableStream uploading is not supported" when fetch()ing a Request that ha...
Jeffrey Posnick
Reported 2019-10-30 10:40:25 PDT
Created attachment 382328 [details] Screenshot of the failure sequence. This came up at https://github.com/GoogleChrome/workbox/issues/1732, and was originally mentioned at https://stackoverflow.com/questions/49850705. While it has more to do with the Fetch API than Service Workers, I didn't see a dedicated Component for Fetch, so I chose Service Workers. An attempt to call fetch(request) will lead to a "NotSupportedError: ReadableStream uploading is not supported" when request is a Request object that contains a body and has been previously logged to the JS console. This failure occurs whether the logging is implicit, by virtue of typing in an interactive command in the JS console (which logs the return value immediately after execution) or explicit from code, via console.log(request). You can reproduce this issue by navigating to https://example.com in any recent version of Safari (I tested with Safari 13 on OS X 10.14.6), choosing "Show JavaScript console" from the Develop menu, and entering the following: > res = await fetch(new Request('https://example.com', {method: 'POST', body: Math.random()})) < undefined [Info] Response {type: "basic", url: "https://example.com/", redirected: false, status: 200, ok: true, …} > req = new Request('https://example.com', {method: 'POST', body: Math.random()}) < Request {method: "POST", url: "https://example.com/", headers: Headers, destination: "", referrer: "about:client", …} > res = await fetch(req) NotSupportedError: ReadableStream uploading is not supported The first sequence succeeds, because the new Request is created inside of the fetch() call and is not logged to the JS console. The second sequence fails, because the new Request is logged to the JS console automatically after creation, and then using it via fetch(req) triggers the exception. Attached is a screenshot of this in action if that's easier to follow. No other browsers demonstrate this issue. Logging a request to the JS console should change whether or not the request is eligible to be sent via fetch(). Presumably whatever ends up implicitly converting the Request body to a ReadableStream should be disabled when logging to the JS console.
Attachments
Screenshot of the failure sequence. (113.97 KB, image/png)
2019-10-30 10:40 PDT, Jeffrey Posnick
no flags
Patch (9.45 KB, patch)
2022-01-05 02:08 PST, youenn fablet
no flags
Patch (10.02 KB, patch)
2022-01-05 05:30 PST, youenn fablet
no flags
Radar WebKit Bug Importer
Comment 1 2019-10-30 23:02:47 PDT
Kevin Gibbons
Comment 2 2021-12-16 17:20:49 PST
Logging to the console isn't the problem, it's trying to access the `body` property at all. A simpler reproduction is ``` let req = new Request('/', { method: 'post', body: 'stuff' }); req.body; // this has effects! remove it and the line below will work fetch(req); // this doesn't work ```
youenn fablet
Comment 3 2022-01-05 02:08:10 PST
youenn fablet
Comment 4 2022-01-05 05:30:32 PST
EWS
Comment 5 2022-01-06 01:31:04 PST
Committed r287675 (245772@main): <https://commits.webkit.org/245772@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 448381 [details].
Note You need to log in before you can comment on or make changes to this bug.