Unable to trigger Firebase callable function

Currently, my project is utilizing the Vue framework. I have integrated Firebase services, including Firestore, realtime database, triggered cloud functions, and onCall functions. Everything was functioning properly until recently when all of the callable functions suddenly stopped working. Whenever I try to invoke a callable function, the code breaks, and an unusual error appears in the console. Strangely, the Firebase functions logs do not show any activity, indicating that the function doesn't even start.

The error message displayed is as follows:

TypeError: Cannot use 'in' operator to search for 'Notification' in undefined
at ContextProvider.eval (index.esm.js?10fa:207)
at step (tslib.es6.js?40cb:102)
at Object.eval [as next] (tslib.es6.js?40cb:83)
at eval (tslib.es6.js?40cb:76)
at new Promise (<anonymous>)
at __awaiter (tslib.es6.js?40cb:72)
at ContextProvider.getInstanceIdToken (index.esm.js?10fa:204)
at ContextProvider.eval (index.esm.js?10fa:232)
at step (tslib.es6.js?40cb:102)
at Object.eval [as next] (tslib.es6.js?40cb:83)

The specific error involving the "'in' operator to search for 'Notification' in undefined" is within the Firebase code located in the node modules.

edit:

Below is the code snippet of the local function calling the cloud function:

 async send(index) {
...
 await serv_inviteMatch({invitation, myId:myUser.answers.id, 
 matchId:this.user.answers.id})
}

Code snippet from firebase/functions.js:

import Firebase from "firebase/app";
import 'firebase/functions';
... 
export const serv_inviteMatch = Firebase.functions().httpsCallable('inviteMatch');

Code snippet from functions/index.js:

exports.inviteMatch = functions.https.onCall(async (invitationData) =>{...})

Answer №1

When it comes to building a cloud function, there is a specific approach that should be followed to effectively handle errors and promises. For instance, it is not necessary to make the cloud function asynchronous. I recommend checking out the tutorial series by the Firebase team to gain a better understanding of how different types of Firebase functions are created and how to write them.

It appears that your cloud function is asynchronous, so make sure to terminate it correctly as advised by Firebase:

Resolve functions that involve asynchronous processing (referred to as "background functions") by returning a JavaScript promise.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error: Attempted the use of 'append' method on an object lacking the implementation of FormData interface, with both processData and contentType set to false

Apologies for any English errors. I am attempting to use ajax to submit a form, and here is my JavaScript code: $("#formPublicidad").on('submit', function(event) { event.preventDefault(); var dataForm = new FormData(document.getElementBy ...

Trouble with JavaScript loading in HTML webpage

<!DOCTYPE html> <html> <head> <title>Breakout Game</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <canvas width="900" height="450" class="canvas"></canvas> ...

What is the method to permanently install and enforce the latest version using npm?

We are implementing a private npm module for exclusive use within our organization. Given that the module is managed internally, we have confidence in version updates and changes. Is there a way to seamlessly install this module across multiple projects s ...

What is the best way to toggle the visibility of fields on a modal in a Ruby on Rails

I am working on an application that utilizes Rails 4.1 and Ruby 2.1.2. The show.html.erb view for the Assignment Model in this application is as follows: <h1><%= "#{'Source URL'}"%> <div class="source-url"><%= @assignment.so ...

Unable to verify the el-select elementUI

I have attempted to implement custom validation with el-select in the following manner: Within my template: <el-form ref="form" > <el-form-item prop="fieldProp"> <el-select class="dialog-select" v-model="informationForm.age" @change=" ...

The class 'ConsoleTVsChartsCharts' could not be located

Attempting to implement Laravel charts using the package consoletvs/charts:6.*, Utilizing service providers ConsoleTVs\Charts\ChartsServiceProvider::class, With an alias: 'Charts' => ConsoleTVs\Charts\Charts::class, ...

Selecting the next element in the DOM using Javascript

Here is the structure of my current setup: <div class="wrapper"> <div class="first"> <a class="button" href="">click</a> </div> <div class="second"> <div class="third"> S ...

Implement AJAX in order to circumvent fees from Google Maps and display maps exclusively upon user interaction by clicking a designated button

Starting July 16, 2018, the Google Maps API is no longer completely free. After July 16, 2018, in order to continue utilizing the Google Maps Platform APIs, you must activate billing for each of your projects. (https://developers.google.com/maps/documentat ...

Is there a way to use JQuery to make one button trigger distinct actions in two different divs?

For instance: Press a button - one div flies off the screen while another div flies in. Press the button again - Same div flies out, other div returns. I'm completely new to Javascript/JQuery so any assistance would be highly appreciated! Thank you ...

Configuring lazy loaded modules with Angular 2 router

I am in the process of developing a service that utilizes router configuration to generate a map of routes based on components. Everything works smoothly except when dealing with lazy loaded module routes. I'm stuck on how to retrieve routes from a l ...

I encountered a response error code 500 from the development server while using my emulator

As I embark on setting up the react-native environment for development, I encounter an error when executing the command react-native run-android. root@pc:~/l3/s2/DevMobMultipltm/Wakapp# ` A series of tasks are carried out including scanning folders for sy ...

Ember.js encountering an "Access-Control-Allow-Origin" error with Ajax

Seeking opinions on how to resolve the Access-Control-Allow-Origin issue in this simple Ajax code snippet. Attempts to define the Ember "Access-Control-Allow-Origin": "* " have been unsuccessful. Has anyone with a similar problem found a solution? The URL ...

Saving iFrame as Image using Codemirror and html2canvas

Here are a few experiments I conducted with html2canvas: Fiddle 1 (Using html2canvas): Fiddle 2 (Using html2canvas without Codemirror): Fiddle 3 (Using html2canvas with Codemirror): Fiddle 4 (Using html2canvas with Codemirror): I recently wante ...

Ensure that each item rendered in a VUE.js v-for loop is distinct and not repetitive

I have obtained a JSON formatted object from a Web API that contains information about NIH funding grants. Each grant provides a history of awards for a specific researcher. My goal is to display only the latest award_notice_date for each unique project ...

What is the best way to implement a timer or interval system in React and Next.js that continues running even when the tab is not in focus or the browser is in

I am attempting to create a stopwatch feature using next js. However, I have encountered an unusual issue where the stopwatch does not function correctly when the tab is not focused or when the system goes to sleep or becomes inactive. It appears that the ...

Manipulating Objects and Arrays

When I retrieve data from a database query in Node.js using Postgres with Knex, I get an array of objects structured like this: (condensed version) [ { tvshow: 'house', airdate: 2017-02-01T00:00:00.000Z }, { tvshow: ' ...

Is there a way to obtain the coordinates of an SVG element by simply clicking on a specific point?

I'm still learning about SVG and I'm trying to trigger an event that captures the click coordinates when clicking on the SVG. I have a few questions: Since I'm using Angular, I'm unsure if it's possible to keep my function in th ...

Issue with Socket.IO: socket.on not executed

Recently, I devised a custom asynchronous emitter for implementing a server -> client -> server method. Regrettably, the functionality is not meeting my expectations. Although it emits the event, it fails to execute the callback as intended. Upon a ...

Implementing dynamic keys in a JSON data structure with Node.js

Specifically focused on utilizing Node.js ES6 capabilities. I am currently working on creating a JSON document for insertion into a MongoDB database. The keys for inserting the document will be derived from the input values provided. For instance, Here i ...

Update a specific form data field within an Angular application

I recently encountered a situation where I had an angular form with 9 fields and submitted it to the server using a post request. However, I realized that I had only filled in values for 8 fields while leaving one as null. Now, in a new component, I am w ...