Closed
Description
Related issues
Version info
node: 16.5.0
firebase-functions: 4.3.0
firebase-tools: 11.28.0
firebase-admin: 11.7.0
Test case
const functions = require('firebase-functions/v2');
const {onDocumentCreated} = require('firebase-functions/v2/firestore');
const admin = require('firebase-admin');
admin.initializeApp();
exports.oncreateproduct = onDocumentCreated("products", (event) => {
console.log('oncreateproduct triggered');
});
exports.addproduct = functions.https.onCall(async (req, res) => {
return {data: ''};
});
exports.addbrand = functions.https.onCall(async (req, res) => {
return {data: ''};
});
Steps to reproduce
- Create functions.
- Run emulators for Firestore and Functions.
- Attempt to create a new product using the Emulator Suite or from the app using the SDK.
Expected behavior
Expecting the function to be triggered when a new product is created.
Actual behavior
- The function is not registered and does not appear in the logs when starting emulators. Only https callable initialized.
- The function does not trigger when creating a product.
Emulator logs:
✔ functions: Loaded functions definitions from source: addproduct, addbrand.
✔ functions[us-central1-addproduct]: http function initialized (http://127.0.0.1:5001/my-project/us-central1/addproduct).
✔ functions[us-central1-addbrand]: http function initialized (http://127.0.0.1:5001/my-project/us-central1/addbrand).
Were you able to successfully deploy your functions?
Yes. It works properly in production mode.