Guest User

Untitled

a guest
Jan 21st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. === Deploying to 'test-ffdbb'...
  2.  
  3. i deploying functions
  4. i functions: ensuring necessary APIs are enabled...
  5. i runtimeconfig: ensuring necessary APIs are enabled...
  6. + runtimeconfig: all necessary APIs are enabled
  7. + functions: all necessary APIs are enabled
  8. i functions: preparing functions directory for uploading...
  9. i functions: packaged functions (1.25 KB) for uploading
  10. + functions: functions folder uploaded successfully
  11. i functions: updating function onProductCreated...
  12. ! functions[onProductCreated]: Deployment error.
  13. Failed to configure trigger providers/cloud.firestore/eventTypes/document.create@firestore.googleapis.com (onProductCreated)
  14.  
  15. const functions = require('firebase-functions');
  16. const algoliasearch = require('algoliasearch');
  17.  
  18. // App ID and API Key are stored in functions config variables
  19. const ALGOLIA_ID = functions.config().algolia.app_id;
  20. const ALGOLIA_ADMIN_KEY = functions.config().algolia.api_key;
  21.  
  22. const ALGOLIA_INDEX_NAME = "Firestore";
  23. const client = algoliasearch(ALGOLIA_ID, ALGOLIA_ADMIN_KEY);
  24.  
  25. // Update the search index every time a blog post is written.
  26. exports.onProductCreated = functions.firestore
  27. .document("Product Catalog/{id}")
  28. .onCreate(event => {
  29. const product = event.data.data();
  30. product.objectID = event.params.postId;
  31.  
  32. const index = client.initIndex(ALGOLIA_INDEX_NAME);
  33. return index.saveObject(product);
  34. });
  35.  
  36. {
  37. "name": "functions",
  38. "description": "Cloud Functions for Firebase",
  39. "scripts": {
  40. "serve": "firebase serve --only functions",
  41. "shell": "firebase experimental:functions:shell",
  42. "start": "npm run shell",
  43. "deploy": "firebase deploy --only functions",
  44. "logs": "firebase functions:log"
  45. },
  46. "dependencies": {
  47. "@google-cloud/firestore": "^0.8.2",
  48. "algoliasearch": "^3.24.5",
  49. "firebase-admin": "~5.4.2",
  50. "firebase-functions": "^0.7.1"
  51. },
  52. "private": true
  53. }
  54.  
  55. exports.onProductCreated = functions.firestore
  56. .document("ProductCatalog/{id}") // <== space removed
  57. .onCreate(event => {...});
  58.  
  59. product.objectID = event.params.postId;
Add Comment
Please, Sign In to add comment