'firebase.auth is not a function' error after SDK update

前端 未结 2 1170
天命终不由人
天命终不由人 2021-01-25 17:19

I am using the Firebase JS sdk for the web without any problems for a year now. After updating my code from the version 5.3.1 to use the latest 6.5.0 S

相关标签:
2条回答
  • 2021-01-25 18:03

    As explained in the doc (Tab "From the CDN"), importing firebase-app.js only is not sufficient: you need, in addition, to import all the libraries of the Firebase products you want to use (Firebase Auth, Firestore, etc...).

    So, in your case, you should do as follows:

    <script src="https://www.gstatic.com/firebasejs/X.Y.Z/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/X.Y.Z/firebase-auth.js"></script>
    

    where X.Y.Z is the version number of the libraries, i.e. 6.6.1 at the time of writing.

    0 讨论(0)
  • 2021-01-25 18:18

    Change this:

    <script src="https://www.gstatic.com/firebasejs/6.5.0/firebase-app.js"></script>
    

    to this:

    <script src="https://www.gstatic.com/firebasejs/6.6.1/firebase.js"></script>
    
    0 讨论(0)
提交回复
热议问题