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.

this._document.origin is undefined

See original GitHub issue

🐛 Bug Report

When trying to use shallow on a component, I get TypeError: Cannot read property 'origin' of undefined at Window.get localStorage. I have ComponentWillMount that is calling to a service that saves to local storage. The trace prints out an issue with JSDOM.

node_modules/jsdom/lib/jsdom/browser/Window.js:256:26

To Reproduce

const wrapper = shallow(<MyComponent />

System:
    OS: macOS 10.14
    CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  Binaries:
    Node: 10.3.0 - /usr/local/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 6.1.0 - /usr/local/bin/npm
  npmPackages:
    jest: 23.6.0 => 23.6.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13

github_iconTop GitHub Comments

6reactions
tinchocommented, Aug 28, 2019

Hi there. I’m getting these too…

Kind of randomly… After removed node_modules and reinstalling again it stopped for a while, then again.

My project uses localForage (for IndexedDB) and localStorage but this error comes up in unrelated files. I mean: the tests that fail and show this message are not related to localStorage at all.

I’d guess its a JSDOM error but since googling brought me straight here and it’s the same error just wanted to add as a +1

5reactions
karangarg45commented, Apr 23, 2019

@thezachcannon i am facing the same issue…How were you able to fix this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

document.origin is undefined and cors policy violation
I made an api that is located at path localhost:3000 and localhost:3000/api/users returns users in json format.
Read more >
document.origin is deprecated #539 - gnab/remark - GitHub
Chrome is reporting the following warning in the console: document.origin is deprecated and will be removed in M70, around October 2018.
Read more >
Document.origin - Web APIs - MDN Web Docs
The Document.origin read-only property returns the document's origin. In most cases, this property is equivalent to document.
Read more >
Solve the Cross-Origin Access error when working with iframes
This post will breifly explain the Cross-Origin access problem that is faced when accesing an iframe document and how you can setup your ......
Read more >
JavaScript undefined Property - W3Schools
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP,...
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