Unhandled Exception: [firebase_functions/not-found] NOT_FOUND


I’m trying to write data to firestore by using cloud function this my code


const functions = require('firebase-functions');

exports.addfield = functions.firestore
  .onCreate((snap, context) => {



Future<void> addfield() async {
      HttpsCallable callable = FirebaseFunctions.instance.httpsCallable('addfield');
      await callable.call();

when I call my function

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: [firebase_functions/not-found] NOT_FOUND


onCreate is not a callable function, it is triggered when a document is created. The callable function is defined like this:

exports.addfield = functions.https.onCall((data, context) => {
  // ...

See Call functions from your app for details.

To create a document there is no need for functions, see Add data to Cloud Firestore.

Answered By – user18309290

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published