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.

Uncaught TypeError: Cannot read property 'id' of null

See original GitHub issue

My main app has an iframe within a component that looks as follows: <iframe id="frameId1" src="http://localhost:51219/" style="width: 100%;" scrolling="no"/> with plugins: [ broadcast('frameId1') ] within the store.

The localhost URL is obviously what the iframe is displaying. It displays it fine (it is also a Vue application) and I need to sync my Vuex state with it. (Is it possible to share state with a Vue application specified in the iframe as a URL like this??? I am trying to move towards microfrontends and thus want components to be deployable separately so they will live on a different server/domain.)

It has plugins: [ transfer() ]

Within its store in order to sync the Vuex state from the main app in to the child app.

However, I just get this same error on the frame app displayed in console:

vuex-iframe-sync.es.js?4ec3:1 Uncaught TypeError: Cannot read property ‘id’ of null at eval (vuex-iframe-sync.es.js?4ec3:1) at eval (vuex.esm.js?edaa:343) at Array.forEach (<anonymous>) at new Store (vuex.esm.js?edaa:343) at eval (store.js?ac69:12) at Object.<anonymous> (commons.js?v=636849159444181352:170) at webpack_require (commons.js?v=636849159444181352:55) at eval (layout.js?5b7c:1) at Object.9 (layout.js?v=636849159444111345:29) at webpack_require (commons.js?v=636849159444181352:55)

I cannot for the life of me figure out what is causing this error? Would really appreciate it if we could figure out the problem.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
rulrokcommented, Sep 28, 2020

@ogulcantumdogan Any more details of frameworks and libraries you are using? In my case, I am building an app with quasar framework for a spa+ssr (server side rendering). I just don’t run this code during the ssr phase, i.e, I don’t run this code on node.js which would throw an error because window object does not exist on node.js.

But running it on a browser I don’t remember having this problem.

Are you building your app with ssr?

Otherwise, I guess you could try something like

if(window !== void 0){
   // use the plugin here
}
0reactions
Rusterycommented, Apr 8, 2021

Based on plugin’s source code: https://github.com/L-Chris/vuex-iframe-sync/blob/6fddf4b353b96a1a4b75f9b60ec3c86655d492e3/src/index.js#L22-L28 you are able to pass an id of the child frame into the transfer() function. After that, the error is gone, but there appears another one with the browser’s CORS things.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix 'Cannot read property 'id' of 'null' - Stack Overflow
If the error message says "Could not read property 'id' of null" it means that the guild ...
Read more >
Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >
what does cannot read property ID of null mean?
If the error message says "Could not read property 'id' of null" it means that the guild property exists, but it is null....
Read more >
TypeError: Cannot read property 'id' of null - Help - Postman
I'm getting a message “There was an error in evaluating the test script: TypeError: Cannot read property 'id' of null”. This is my...
Read more >
Cannot read property 'id' of null - MongoDB
I'm getting an error when I want to export a default realm configuration useRealm so that I will be able to use it...
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