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.

Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome.

See original GitHub issue

I updated to version 1.92.0 from 1.89.1 (working on iOS) and I am getting following warning when I debug react-native app

index.bundle?platform=ios&dev=true&minify=false:48831 0 Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome.

 Consider providing alternative methods to expose this method in debug mode, e.g. by exposing constants ahead-of-time.
    at invariant (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:1899:17)
    at MessageQueue.callNativeSyncHook (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3030:11)
    at Object.nonPromiseMethodWrapper [as peerConnectionInit] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2724:32)
    at new RTCPeerConnection (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:109188:20)
    at getNativeRtpCapabilities$ (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:167274:22)
    at tryCatch (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:26662:19)
    at Generator.invoke [as _invoke] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:26835:24)
    at Generator.next (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:26705:23)
    at tryCatch (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:26662:19)
    at invoke (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:26735:22)

Expected behavior

I shouldn’t not be getting this warning.

Ps: It works fine if you aren’t debugging

What have I tried to fix it

  1. Removed node_modules and installed again
  2. Remove pods folder and podlock file
  3. npm reset cache

Platform information

  • React Native version: 0.62.2
  • Plugin version: 1.92.0
  • OS: Tested on iOS
  • OS version:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
Romick2005commented, Jun 23, 2022

Hi @irohitb,

Improving data channel communication cause this issue.

As there are not so important updates and not so significant improvements I would recommend you to downgrade to react-native-webrtc@1.89.1 for debugging. For production/staging it will work also, but if you want, you can have the latest version for production/staging and 1.89.1 for debugging,

4reactions
Romick2005commented, Jun 23, 2022

Please do not follow random advice which tells you to downgrade. You may expose your users to security issues, we don’t support old releases.

Please provide a normal workable chrome debugging solution, then there will be no such advise. For debugging we have to use 1.89.1, but for prod I recommend to use latest. I still do not understand why this library require initial sync operations that is blocking debugging? Please fix it if you can do it or follow practical advise on random comments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invariant Violation: Calling synchronous methods on native ...
Invariant Violation : Calling synchronous methods on native modules is not supported in Chrome. Consider providing alternative methods to expose ...
Read more >
Calling synchronous methods on native modules is ... - GitHub
Invariant Violation : Calling synchronous methods on native modules is not supported in Chrome. Consider providing alternative methods to ...
Read more >
Calling synchronous methods on native modules is ... - Reddit
Calling synchronous methods on native modules is not supported in Chrome and 'main' has not been registered ... This error is due to...
Read more >
Cannot debug in chrome - Issues developing apps - OpenVidu
Invariant Violation : Calling synchronous methods on native modules is not supported in Chrome. Consider providing alternative methods to expose ...
Read more >
Invariant Violation: Calling synchronous methods on native ...
Coding example for the question Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome-React Native.
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