Facebook SDK error: init not called with valid version









up vote
0
down vote

favorite
1












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!










share|improve this question



















  • 1




    yup, I just edited my question to include that I already added fb-root. @Tholle
    – awebdev
    Nov 9 at 20:14










  • Have you tried adding &version=v2.0 to the js.src in the script?
    – Tholle
    Nov 9 at 20:15






  • 1




    Yup, I add ?version=v2.0 to js.src @Tholle
    – awebdev
    Nov 9 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
    Nov 9 at 20:30






  • 1




    Just posted a solution that works for me @Tholle
    – awebdev
    Nov 9 at 20:49














up vote
0
down vote

favorite
1












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!










share|improve this question



















  • 1




    yup, I just edited my question to include that I already added fb-root. @Tholle
    – awebdev
    Nov 9 at 20:14










  • Have you tried adding &version=v2.0 to the js.src in the script?
    – Tholle
    Nov 9 at 20:15






  • 1




    Yup, I add ?version=v2.0 to js.src @Tholle
    – awebdev
    Nov 9 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
    Nov 9 at 20:30






  • 1




    Just posted a solution that works for me @Tholle
    – awebdev
    Nov 9 at 20:49












up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





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!










share|improve this question















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!







javascript reactjs facebook facebook-javascript-sdk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 20:13

























asked Nov 9 at 20:08









awebdev

509




509







  • 1




    yup, I just edited my question to include that I already added fb-root. @Tholle
    – awebdev
    Nov 9 at 20:14










  • Have you tried adding &version=v2.0 to the js.src in the script?
    – Tholle
    Nov 9 at 20:15






  • 1




    Yup, I add ?version=v2.0 to js.src @Tholle
    – awebdev
    Nov 9 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
    Nov 9 at 20:30






  • 1




    Just posted a solution that works for me @Tholle
    – awebdev
    Nov 9 at 20:49












  • 1




    yup, I just edited my question to include that I already added fb-root. @Tholle
    – awebdev
    Nov 9 at 20:14










  • Have you tried adding &version=v2.0 to the js.src in the script?
    – Tholle
    Nov 9 at 20:15






  • 1




    Yup, I add ?version=v2.0 to js.src @Tholle
    – awebdev
    Nov 9 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
    Nov 9 at 20:30






  • 1




    Just posted a solution that works for me @Tholle
    – awebdev
    Nov 9 at 20:49







1




1




yup, I just edited my question to include that I already added fb-root. @Tholle
– awebdev
Nov 9 at 20:14




yup, I just edited my question to include that I already added fb-root. @Tholle
– awebdev
Nov 9 at 20:14












Have you tried adding &version=v2.0 to the js.src in the script?
– Tholle
Nov 9 at 20:15




Have you tried adding &version=v2.0 to the js.src in the script?
– Tholle
Nov 9 at 20:15




1




1




Yup, I add ?version=v2.0 to js.src @Tholle
– awebdev
Nov 9 at 20:26




Yup, I add ?version=v2.0 to js.src @Tholle
– awebdev
Nov 9 at 20:26




1




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
Nov 9 at 20:30




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
Nov 9 at 20:30




1




1




Just posted a solution that works for me @Tholle
– awebdev
Nov 9 at 20:49




Just posted a solution that works for me @Tholle
– awebdev
Nov 9 at 20:49












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










The 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.net/en_US/sdk.js#version=v2.2&appId=myAppId&xfbml=true&autoLogAppEvents=true";





share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232654%2ffacebook-sdk-error-init-not-called-with-valid-version%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    The 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.net/en_US/sdk.js#version=v2.2&appId=myAppId&xfbml=true&autoLogAppEvents=true";





    share|improve this answer
























      up vote
      1
      down vote



      accepted










      The 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.net/en_US/sdk.js#version=v2.2&appId=myAppId&xfbml=true&autoLogAppEvents=true";





      share|improve this answer






















        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        The 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.net/en_US/sdk.js#version=v2.2&appId=myAppId&xfbml=true&autoLogAppEvents=true";





        share|improve this answer












        The 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.net/en_US/sdk.js#version=v2.2&appId=myAppId&xfbml=true&autoLogAppEvents=true";






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 20:49









        awebdev

        509




        509



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232654%2ffacebook-sdk-error-init-not-called-with-valid-version%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo