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.

Cannot read property 'pageLoader' of null

See original GitHub issue

Bug report

Hey guys, I saw this issue #9951 being resolved, but I am having the same error with react-testing library

Describe the bug

I am trying to test a component, but have “Cannot read property ‘pageLoader’ of null” all over my tests (actually as many of them as many Links I have on a tested page)

I am using NextJs with Redux example and test it with react-testing-library.

the error:

[Error: Uncaught [TypeError: Cannot read property 'pageLoader' of null]
at reportException (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:62:24)
at innerInvokeEventListeners (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:332:9)
at invokeEventListeners (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:267:3)
at HTMLUnknownElementImpl._dispatch (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:214:9)
at HTMLUnknownElementImpl.dispatchEvent (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:87:17)
at HTMLUnknownElement.dispatchEvent (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:144:23)
at Object.invokeGuardedCallbackDev (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:385:16)
at invokeGuardedCallback (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:440:31)
at commitRootImpl (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:25082:9)
at unstable_runWithPriority (/Users/vladislavsorokin/webprojects/rqc/node_modules/scheduler/cjs/scheduler.development.js:697:12) TypeError: Cannot read property 'pageLoader' of null
at Link.handleRef (/Users/vladislavsorokin/webprojects/rqc/node_modules/next/dist/client/link.js:8:710)
at ref (/Users/vladislavsorokin/webprojects/rqc/node_modules/next/dist/client/link.js:13:67)
at commitAttachRef (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:22310:7)
at commitLayoutEffects (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:25349:7)
at HTMLUnknownElement.callCallback (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:336:14)
at innerInvokeEventListeners (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:316:27)
at invokeEventListeners (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:267:3)
at HTMLUnknownElementImpl._dispatch (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:214:9)
at HTMLUnknownElementImpl.dispatchEvent (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:87:17)
at HTMLUnknownElement.dispatchEvent (/Users/vladislavsorokin/webprojects/rqc/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:144:23)
at Object.invokeGuardedCallbackDev (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:385:16)
at invokeGuardedCallback (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:440:31)
at commitRootImpl (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:25082:9)
at unstable_runWithPriority (/Users/vladislavsorokin/webprojects/rqc/node_modules/scheduler/cjs/scheduler.development.js:697:12)
at runWithPriority$2 (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:12149:10)
at commitRoot (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:24922:3)
at finishSyncRender (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:24329:3)

at performSyncWorkOnRoot (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:24307:9)
at scheduleUpdateOnFiber (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:23698:7)
at updateContainer (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:27103:3)
at /Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:27528:7
at unbatchedUpdates (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:24433:12)
at legacyRenderSubtreeIntoContainer (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:27527:5)
at Object.render (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:27608:10)
at /Users/vladislavsorokin/webprojects/rqc/node_modules/@testing-library/react/dist/pure.js:86:25
at batchedUpdates$1 (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom.development.js:24386:12)
at act (/Users/vladislavsorokin/webprojects/rqc/node_modules/react-dom/cjs/react-dom-test-utils.development.js:1092:14)
at render (/Users/vladislavsorokin/webprojects/rqc/node_modules/@testing-library/react/dist/pure.js:82:26)
at render (/Users/vladislavsorokin/webprojects/rqc/utils/test-utils.js:28:10)
at Object.<anonymous> (/Users/vladislavsorokin/webprojects/rqc/__tests__/index.test.js:12:25)
at Object.asyncJestTest (/Users/vladislavsorokin/webprojects/rqc/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:100:37)
at /Users/vladislavsorokin/webprojects/rqc/node_modules/jest-jasmine2/build/queueRunner.js:45:12
at new Promise (<anonymous>)
at mapper (/Users/vladislavsorokin/webprojects/rqc/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
at /Users/vladislavsorokin/webprojects/rqc/node_modules/jest-jasmine2/build/queueRunner.js:75:41
at processTicksAndRejections (internal/process/task_queues.js:85:5)

System information

  • OS:macOS 10.14.6
  • Version of Next.js: 9.3.5
  • Version of Node.js: 12.6.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sorokinvjcommented, May 4, 2020

@doniyor2109 worked, thanks! Strangely, why ‘latest’ in package.json didn’t work?

1reaction
sorokinvjcommented, Apr 28, 2020

@doniyor2109 this is the repo https://github.com/sorokinvj/rqc-next-tests, basically its just three news cards that fetched from prismic.io (cms) and showed in ui

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'pageLoader' of null #11999 - GitHub
I am trying to test a component, but have "Cannot read property 'pageLoader' of null" all over my tests (actually as many of...
Read more >
ERROR TypeError: Cannot read property 'style' of null
I am working on angular 8 project and was trying to add page screen overlay but facing ERROR TypeError: Cannot read property 'style'...
Read more >
slick ypeError: Cannot read property 'add' of null Code Example
Answers related to “slick ypeError: Cannot read property 'add' of null”. cannot read property of undefined (reading 'push') react · Uncaught TypeError: ...
Read more >
Bug #1409085 “SIGSEGV in qtcreator start wizard” - Launchpad Bugs
file:///usr/share/qtcreator/welcomescreen/widgets/PageLoader.qml:46: TypeError: Cannot read property 'height' of null "application/x-goproject"
Read more >
Javascript removeclass - - Convittiadi Campobasso
Setting the class attribute to empty will remove all classes from the ... but I get an error saying "TypeError: Cannot read property...
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