• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once

Trying to remove the users`s data calling a function from app.

'use strict'; const functions = require('firebase-functions'); const firebase_tools = require('firebase-tools'); const admin = require('firebase-admin'); const serviceAccount = require('./myapp.json');  admin.initializeApp({   credential: admin.credential.cert(serviceAccount),   databaseURL: "https://myapp.firebaseio.com" }); let db = admin.firestore();   exports.mintAdminToken = functions.https.onCall((data, context) => {   const uid = data.uid;    return admin     .auth()     .createCustomToken(uid, { admin: true })     .then(function(token) {       return { token: token };     }); });  exports.recursiveDelete = functions   .runWith({     timeoutSeconds: 540,     memory: '1GB'   })   .https.onCall((data, context) => {      if (!(context.auth && context.auth.token )) {       throw new functions.https.HttpsError(         'permission-denied',         'Must be an administrative user to initiate delete.'       );     }     let path = data.path;     console.log(       `User ${context.auth.uid} has requested to delete path ${path}`     );      return firebase_tools.firestore       .delete(path, {         project: process.env.GCLOUD_PROJECT,         recursive: true,         yes: true,         token: functions.config().fb.token       })       .then(() => {         return {           path: path         };       });   }); 

and I pass the path like:

    Map data = new HashMap<>();     data.put("path", "./users/rnAjpK4LLSMMlENZqe4l3F2"); 


Function execution took 540003 ms, finished with status: 'timeout' 

probably the problem is in path. if I change for this line:

let path = admin.firestore().doc('users/' + context.auth.uid); 

Im getting an error

Unhandled error TypeError: this.path.replace is not a function at new FirestoreDelete  

is the problem with "path"? what will be the right path to delete then?

I use this example https://github.com/firebase/snippets-node/tree/master/firestore/solution-deletes but here is nothing about it

Download script demo [LINK]
Download script demo [LINK 2] Download script demo [LINK 2]