I get this error:
TypeError: Cannot read property 'collection' of undefined
at /srv/node_modules/integrify/lib/rules/replicateAttributes.js:61:18
at Array.forEach (<anonymous>)
at /srv/node_modules/integrify/lib/rules/replicateAttributes.js:47:22
at cloudFunctionNewSignature (/srv/node_modules/firebase-functions/lib/cloud-functions.js:105:23)
at /worker/worker.js:825:24
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
I have the following Firebase Cloud Function running in Node 8 environment with Typescript code:
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
const { integrify } = require('integrify');
admin.initializeApp();
const firestore = admin.firestore();
integrify({ config: { functions, firestore } });
exports.inventory_item_replicate = integrify({
rule: 'REPLICATE_ATTRIBUTES',
source: {
collection: 'inventory_item',
},
targets: [
{
collection: 'cart',
foreignKey: 'id',
attributeMapping: {
'barcode': 'barcode',
'category': 'category',
'image': 'image',
'name': 'name',
'price': 'price',
'stock': 'stock',
'type': 'type',
},
},
],
});
The replication function seems to fire correctly after an update on the original collection, as I can see from the logs, and the error is logged directly afterwards:
integrify: Detected update in [inventory_item], id [QmNKvERKZI3HFEyKz3Ft],
new value: { ...
...
...
...
integrify: On collection [cart], applying update: { ....
I get this error:
I have the following Firebase Cloud Function running in Node 8 environment with Typescript code:
The replication function seems to fire correctly after an update on the original collection, as I can see from the logs, and the error is logged directly afterwards: