title: Firebase Functions not able to use oncall functions in app, returns internal error
body: <h1>Firebase Functions onCall not working</h1>
  I was recently following the Firebase tutorial series by <strong>The Net Ninja</strong> YouTube channel.
  <hr />
  <h3><a href="https://www.youtube.com/playlist?list=PL4cUxeGkcC9i_aLkr62adUTJi53y7OjOf" rel="noreferrer" title="The Net Ninja Firebase Functions Playlist">The Net Ninja Firebase Function Playlist</a></h3>
  <a href="https://www.youtube.com/watch?v=8mL1VuiL5Kk&amp;list=PL4cUxeGkcC9i_aLkr62adUTJi53y7OjOf&amp;index=5&amp;t=315s" rel="noreferrer" title="The Net Ninja Firebase Functions Tutorial #5 - Callable Functions">Firebase Functions Tutorial #5 - Callable Functions</a>
  <hr />
  <p>And I got stuck in the firebase functions part, first I was not even able to deploy them because billing was enabled in my account, then I put the node version in the package.json to '8', it didn't ask for billing when I deployed the functions.</p>
  <blockquote>
  <p><em>package.json</em></p>
  </blockquote>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;name&quot;: &quot;functions&quot;,
    &quot;description&quot;: &quot;Cloud Functions for Firebase&quot;,
    &quot;scripts&quot;: {
      &quot;lint&quot;: &quot;eslint .&quot;,
      &quot;serve&quot;: &quot;firebase emulators:start --only functions&quot;,
      &quot;shell&quot;: &quot;firebase functions:shell&quot;,
      &quot;start&quot;: &quot;npm run shell&quot;,
      &quot;deploy&quot;: &quot;firebase deploy --only functions&quot;,
      &quot;logs&quot;: &quot;firebase functions:log&quot;
    },
    &quot;engines&quot;: {
      &quot;node&quot;: &quot;8&quot;
    },
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;dependencies&quot;: {
      &quot;firebase-admin&quot;: &quot;^8.10.0&quot;,
      &quot;firebase-functions&quot;: &quot;^3.6.1&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;eslint&quot;: &quot;^5.12.0&quot;,
      &quot;eslint-plugin-promise&quot;: &quot;^4.0.1&quot;,
      &quot;firebase-functions-test&quot;: &quot;^0.2.0&quot;
    },
    &quot;private&quot;: true
  }
  </code></pre>
  <p>earlier it was
  <code>&quot;node&quot;: &quot;10&quot;</code></p>
  <p>After this, I'm able to deploy the functions and even run an <strong>onRequest</strong> function, but not the <strong>onCall</strong> function.
  Whenever I try to call an <strong>onCall</strong> function, I don't know what happens, maybe I get an error I'm not sure.</p>
  <blockquote>
  <p><em>index.js</em> firebase function file</p>
  </blockquote>
  <pre class="lang-js prettyprint-override"><code>const functions = require('firebase-functions');
  
  exports.randomNumber = functions.https.onRequest((request, response) =&gt; {
      const number = Math.round(Math.random() * 100);
      console.log(number);
      response.send(number.toString());
  });
  
  exports.sayHello = functions.https.onCall((data, context) =&gt; {
      console.log('its running');
      return 'hello, ninjas';
  });
  </code></pre>
  <p>The <em>randomNumber</em> runs perfectly, but <strong>sayHello</strong> never runs or whatever.
  I'm calling the <strong>sayHello</strong> function from frontend</p>
  <blockquote>
  <p><em>app.js</em> my web app's javascript file</p>
  </blockquote>
  <pre class="lang-js prettyprint-override"><code>//sayHello function call
  const button = document.querySelector('.call');
  button.addEventListener('click', () =&gt; {
      //get firebase function reference
      const sayHello = firebase.functions().httpsCallable('sayHello');
      sayHello().then(result =&gt; {
          console.log(result.data);
      }).catch(error =&gt; {
          console.log(error);
      });
  });
  </code></pre>
  <p>I'm also initializing firebase properly in the index.html</p>
  <pre class="lang-html prettyprint-override"><code>&lt;!-- The core Firebase JS SDK is always required and must be listed first --&gt;
      &lt;script src=&quot;/__/firebase/7.21.1/firebase-app.js&quot;&gt;&lt;/script&gt;
      &lt;!-- include only the Firebase features as you need --&gt;
      &lt;script src=&quot;/__/firebase/7.21.1/firebase-auth.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;/__/firebase/7.21.1/firebase-firestore.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;/__/firebase/7.21.1/firebase-functions.js&quot;&gt;&lt;/script&gt;
  
      &lt;!-- Initialize Firebase --&gt;
      &lt;script src=&quot;/__/firebase/init.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>In the console of my web app, something gets logged</p>
  <pre><code>Error: internal
      at new y (error.ts:66)
      at w (error.ts:175)
      at A.&lt;anonymous&gt; (service.ts:245)
      at tslib.es6.js:100
      at Object.next (tslib.es6.js:81)
      at r (tslib.es6.js:71)
  </code></pre>
  Can anyone at least tell what this console log means???
  <hr />
  <p>Please help, not able to complete the tutorial series after which I'll move on to some real projects, been stuck at this for a week now.
  Thanks in advance, if can solve my problem.</p>
  <hr />
  <hr />
  <h1>Solution found</h1>
  <hr />
  <p>Just downgrade the javascript sdk version you are using in your front end to 7.21.0, that's it, it'll work.</p>
  <p>The issue was as stated by <em>@DougStevenson</em> below that Firebase callable functions, at the current time (Oct 2020) is not working with javascript sdk 7.21.1 and 7.22.0.</p>
  <p><a href="https://github.com/firebase/firebase-js-sdk/issues/3890" rel="noreferrer">Cannot invoke HttpsCallable functions anymore after upgrading to firebase 7.22.0</a></p>
  <pre><code>&lt;!-- The core Firebase JS SDK is always required and must be listed first --&gt;
      &lt;script src=&quot;/__/firebase/7.21.0/firebase-app.js&quot;&gt;&lt;/script&gt;
      &lt;!-- include only the Firebase features as you need --&gt;
      &lt;script src=&quot;/__/firebase/7.21.0/firebase-auth.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;/__/firebase/7.21.0/firebase-firestore.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;/__/firebase/7.21.0/firebase-functions.js&quot;&gt;&lt;/script&gt;
  
      &lt;!-- Initialize Firebase --&gt;
      &lt;script src=&quot;/__/firebase/init.js&quot;&gt;&lt;/script&gt;
  </code></pre>