Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- === Deploying to 'test-ffdbb'...
- i deploying functions
- i functions: ensuring necessary APIs are enabled...
- i runtimeconfig: ensuring necessary APIs are enabled...
- + runtimeconfig: all necessary APIs are enabled
- + functions: all necessary APIs are enabled
- i functions: preparing functions directory for uploading...
- i functions: packaged functions (1.25 KB) for uploading
- + functions: functions folder uploaded successfully
- i functions: updating function onProductCreated...
- ! functions[onProductCreated]: Deployment error.
- Failed to configure trigger providers/cloud.firestore/eventTypes/document.create@firestore.googleapis.com (onProductCreated)
- const functions = require('firebase-functions');
- const algoliasearch = require('algoliasearch');
- // App ID and API Key are stored in functions config variables
- const ALGOLIA_ID = functions.config().algolia.app_id;
- const ALGOLIA_ADMIN_KEY = functions.config().algolia.api_key;
- const ALGOLIA_INDEX_NAME = "Firestore";
- const client = algoliasearch(ALGOLIA_ID, ALGOLIA_ADMIN_KEY);
- // Update the search index every time a blog post is written.
- exports.onProductCreated = functions.firestore
- .document("Product Catalog/{id}")
- .onCreate(event => {
- const product = event.data.data();
- product.objectID = event.params.postId;
- const index = client.initIndex(ALGOLIA_INDEX_NAME);
- return index.saveObject(product);
- });
- {
- "name": "functions",
- "description": "Cloud Functions for Firebase",
- "scripts": {
- "serve": "firebase serve --only functions",
- "shell": "firebase experimental:functions:shell",
- "start": "npm run shell",
- "deploy": "firebase deploy --only functions",
- "logs": "firebase functions:log"
- },
- "dependencies": {
- "@google-cloud/firestore": "^0.8.2",
- "algoliasearch": "^3.24.5",
- "firebase-admin": "~5.4.2",
- "firebase-functions": "^0.7.1"
- },
- "private": true
- }
- exports.onProductCreated = functions.firestore
- .document("ProductCatalog/{id}") // <== space removed
- .onCreate(event => {...});
- product.objectID = event.params.postId;
Add Comment
Please, Sign In to add comment