The onCall function in Firebase's realtime database does not provide a response data object when executing the remove() operation

When using onCall to perform a remove operation from a realtime database, I encountered an issue where the response only returned null instead of the expected data object. Strangely, I have used onCall for other operations like update and always received a response data object without any problems.

Code snippet for onCall implementation:

exports.DeleteItemToShareRecord = functions.https.onCall((data,context)=>{
  const toDeleteRef = admin.database().ref("items_to_share/" + data["deleteID"]);
  toDeleteRef.remove().then(() => {        
      return { "message" : "item to share deleted" };
  });  
});

Client Implementation:

const deleteShareRecord = httpsCallable( this.functions, 'DeleteItemToShareRecord');
deleteShareRecord({"deleteID" : "" }).then((tresult)=>{ console.log("Delete item resposnse " , tresult); })

Console log:

I received a response like this when trying to delete the item:

{data: null}

data: null

I'm not sure if this is intentional or a bug. Thank you for your help.

Answer №1

Apologies for the error. I realize now that I should have included the return statement for the removal operation, as Dharmaraj mentioned.

return deletedReference.remove().then(() => {        
  return { "message" : "the new ownership process has been successfully completed" };
});    

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

Having trouble with Ionic installation, specifically getting stuck on downloading packages such as lodash and media-ty

During the installation of Ionic on my computer, the process halted at fetchMetadata: sill resolveWithNewModule [email protected] while checking installable status for some time fetchMetadata: sill resolveWithNewModule loadash@version while checking ...

When the onClick event is triggered, the formatted time will be displayed using a combination of Reactive programming,

Greetings! I've been browsing for a while, but this is my first time asking a question. For an in and out board, I'm trying to implement a feature where employees click the "out" button, and using Vue.js v-on:click(), it should display "Out at 3 ...

Tips for successfully mocking axios.get in Jest and passing AxiosPromise type value

I attempted to simulate the axios.get() function using the code below, however TypeScript is returning an error stating "argument of type '{ data: expectedResult }' is not assignable to parameter of type 'AxiosPromise<{}>'". Can any ...

"The Promise in the AngularJS Karma test specification did not resolve and the .then() method was not invoked

An issue arises when attempting to perform AngularJS Karma Unit Testing on a service. The service includes a method like the one below: service.getIntersectingElements = function (element, elements) { var deferred = $q.defer(); var tolerance = 20 ...

Contrasting outcomes when processing identical file in node and python

I've been attempting to access the contents of the genesis.block file provided in the Hyperledger Fabric Node SDK through Python. However, every time I try to read the file using Python with: data = open("twoorgs.genesis.block").read() The value sto ...

While using Google Cloud Function, encountering a TypeError with gspread_pandas stating: 'AuthorizedSession' object is not callable. The issue may stem from loading credentials from Secret Manager

Currently, I am in the process of deploying a Google Cloud Function (v1) using Python 3.12. To load the credentials for gspread_pandas as a json string from Google Secrets Manager into an environment variable, my code is structured as follows; I am attempt ...

What is the procedure for utilizing the comparator to arrange items according to various attributes?

I am trying to find a way to arrange my models in a collection based on their required flag and then alphabetically by their value. This is what my current code looks like: var myModel = Backbone.Model.extend({ defaults: { required: true, ...

The angular-block-ui feature fails to run my HTML code as a personalized message

I'm looking to enhance my UI by implementing a blocking feature with a spinner display. My attempt involved the following code: blockUI.start("<div class='dots-loader'>Minions are Working!</div>"); // code for fetching data ...

Unable to interpret the GET request

I am encountering an issue with reading a GET request on my web server. The request is not being processed as expected and I need the output to be displayed after 10 seconds once the user makes the request. Can anyone provide assistance? The goal of the ...

Determining the appropriate generic type in Typescript

In my code, there is a method designed to extend an existing key-value map with objects of the same type. This can be useful when working with database query results. export function extendWith< T extends { id: string | number }, O = | (T[" ...

Conceal and reveal buttons at the same location on an HTML webpage

There are 3 buttons on my custom page called page.php: <input type="submit" value="Btn 1" id="btn1"> <input type="submit" value="Btn 2" id="btn2" onClick="action();> <input type="submit" value="Btn 3" id="btn3" onClick="action();> ...

I am attempting to retrieve the aria-expanded value using JavaScript, however, I keep receiving an "undefined" response

I'm attempting to dynamically change the class of a <span> element based on the value of the attribute aria-expanded. However, I am encountering an issue where it returns "undefined" instead of the expected value of true or false. Below is the ...

Having trouble implementing connect-busboy in my Node.js application

Currently, I'm trying to implement image uploads in my node.js application using connect-busboy. Here's the code snippet I've written based on the reference guide https://www.npmjs.org/package/connect-busboy: router.post('/upload&apos ...

Mastering the Art of Resizing Video Controls: A

https://i.stack.imgur.com/jTgap.png https://i.stack.imgur.com/Exf6Y.png On the initial screenshot, the video player displays normal controls. However, on the same website with identical CSS, the second video player shows different control settings. // C ...

When using `JSON.stringify`, the resulting data may vary from the original object

Here is the code snippet in question: console.log("444444: ", profile, JSON.stringify(profile)) Upon checking the log output: https://i.stack.imgur.com/LzalV.png I am trying to understand why I cannot see the value: [0] present Additionally, ...

Developing a progress bar with jQuery and Cascading Style Sheets (

Below is the code I'm currently using: <progress id="amount" value="0" max="100"></progress> Here is the JavaScript snippet I have implemented: <script> for (var i = 0; i < 240; i++) { setTimeout(function () { // this repre ...

Express JS backend causing CSS file to fail to load in React project

After doing some research on Stack Overflow, I came across a few solutions but none of them seemed to work for my specific situation. I am currently attempting to serve my React website from an Express backend server. Here is the layout of my folders: cli ...

Utilizing the NuxtJS framework to tap into video camera functionalities

I am completely new to Vue and NuxtJs. My goal is to create a webcam feature using NuxtJs, but I have encountered some challenges. <template> <div class="photobooth"> <div class="controls"> <button @click="takePhoto">Ta ...

Reasons for dividing by 1 in JavaScript

While completing a basic programming assignment from my teacher, I encountered an interesting issue in Javascript. I found that when dividing a number by 1, it returns an unexpected value. Can anyone provide an explanation for this? I have created a jsfidd ...

Insert text within the switch component using Material-UI

Looking to customize Material UI's Switch component with text inside? Check out the image below for an idea of what I'm going for. https://i.stack.imgur.com/KadRZ.png Take a look at my code snippet: import React from 'react'; import S ...