I'm implenting a Facebook share dialog to my React site, and I'm receiving the following error when calling FB.ui():
init not called with valid version
I also manually added <div id="fb-root"></div>
to my index file before the FB.init() script is ran. I am using a valid version, and all my FB init and share code is taken directly from the Facebook docs.
Has anyone else experienced this bug?
Thanks!
I'm implenting a Facebook share dialog to my React site, and I'm receiving the following error when calling FB.ui():
init not called with valid version
I also manually added <div id="fb-root"></div>
to my index file before the FB.init() script is ran. I am using a valid version, and all my FB init and share code is taken directly from the Facebook docs.
Has anyone else experienced this bug?
Thanks!
- 1 yup, I just edited my question to include that I already added fb-root. @Tholle – awebdev Commented Nov 9, 2018 at 20:14
-
Have you tried adding
&version=v2.0
to thejs.src
in the script? – Tholle Commented Nov 9, 2018 at 20:15 - 1 Yup, I add ?version=v2.0 to js.src @Tholle – awebdev Commented Nov 9, 2018 at 20:26
- 1 Ya it's really frustrating :/ Someone asked the same question on here a couple years ago, and there was no official solution. I tried all.js instead of sdk.js. No luck with that either unfortunately. @Tholle – awebdev Commented Nov 9, 2018 at 20:30
- 1 Just posted a solution that works for me @Tholle – awebdev Commented Nov 9, 2018 at 20:49
1 Answer
Reset to default 6The solution that worked for me was to remove fbAsyncInit() and instead, add the FB.init properties to js.src like so:
js.src = "https://connect.facebook/en_US/sdk.js#version=v2.2&appId=myAppId&xfbml=true&autoLogAppEvents=true";