window.URL.createObjectURL Blob ERR_INVALID_ARG_TYPE
See original GitHub issueDescribe the bug
In one of my dependencies, window.window.URL.createObjectURL
is being called, but it does not like the Blob
argument that is being passed in, saying it isn’t a Blob
TypeError: The "obj" argument must be an instance of Blob. Received an instance of Blob
Reproduction
My repro shows the same code in the lib that is failing. It is failing on 0.12.6, before #1340 was released, and on latest.
System Info
System:
OS: macOS 12.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 2.29 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
Yarn: 3.1.1 - ~/.yarn/bin/yarn
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 101.0.4951.64
Firefox: 94.0.1
Safari: 15.4
npmPackages:
@vitejs/plugin-react: ^1.3.2 => 1.3.2
vite: ^2.9.9 => 2.9.9
vitest: 0.12.9 => 0.12.9
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:5 (1 by maintainers)
Top Results From Across the Web
URL.createObjectURL() - Web APIs | MDN
The URL.createObjectURL() static method creates a string containing a URL representing the object given in the parameter.
Read more >window.url.createobjecturl(blob) not working in Edge
I work with the PDFJS Project. I have open blob file in new tap. The below code works in all browsers (Chrome, Firefox,...
Read more >Using URL.createObjectURL() - Chris Ng - Svbtle
Returns a DOMString containing a unique blob URL, that is a URL with ... createObjectURL(targetFile); mediaElem.src = objectURL; window.URL.
Read more >Blob
An alternative to URL.createObjectURL is to convert a Blob into a base64-encoded string. That encoding represents binary data as a string of ...
Read more >Don't build blobs, construct them - Chrome Developers
getBlob ('text/css'); var link = document.createElement('link'); link.rel = 'stylesheet'; link.href = window.URL.createObjectURL(blob);
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 Free
Top 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
I see that jsdom doesn’t support
URL.createObjectURL
at all: issue. If we put jsdom’sURL
on global namespace, this call throws an error.Although Node 16.7 supports it, so you can add to your
setupFiles
:However it may create more issue with jsdom API’s 👀
@mckelveygreg would you mind sharing how you exactly solved it? i’m unable to assign
globalThis.fetch
to thefetch
fromnode-fetch
as the types dont match and it throws a type error for me (using typescript)