- Operating System version: MacOS Mojave (v10.14.2)
- Firebase SDK version: v7.0.0
- Firebase Product: firestore
Describe the problem
Firebase reference documentation states that you can have an options object as the first argument for the DocumentReference.onShapshot() method. This works for the firebase JavaScript client SDK, but not for this Node.js SDK.
Specifying an options object for this package produces the following error:
node_modules/@google-cloud/firestore/build/src/validate.js:93
throw new Error(message);
^
Error: Argument "onNext" is not a valid function.
at Validator.(anonymous function).values [as isFunction] (node_modules/@google-cloud/firestore/build/src/validate.js:93:27)
at Query.onSnapshot (node_modules/@google-cloud/firestore/build/src/reference.js:1485:25)
at Object.subscribeRaw (flamelink-js-sdk/packages/schemas/dist/cjs/cf/index.js:1864:29)
at Object.subscribe (flamelink-js-sdk/packages/schemas/dist/cjs/cf/index.js:1871:24)
at flamelink-js-sdk/packages/schemas/dist/cjs/cf/index.js:2004:21
at Array.forEach (<anonymous>)
at subscribeAndCacheSchemas (flamelink-js-sdk/packages/schemas/dist/cjs/cf/index.js:2003:24)
at factory (flamelink-js-sdk/packages/schemas/dist/cjs/cf/index.js:2023:5)
at schemas (flamelink-js-sdk/packages/schemas/dist/cjs/index.js:13:62)
at flamelink-js-sdk/packages/app/dist/index.node.cjs.js:1249:24
Based on what I could tell, the problem is that this method is only expecting the first argument to be the onNext function:

This code is actually in the @google-cloud/firestore/build/src/reference.js package, but that does not seem to be publicly available apart from via this repo.
Steps to reproduce:
- Initialize Firebase admin app
- Setup listener for a Firestore collection with the first argument an options object
Relevant Code:
const admin = require('firebase-admin')
const adminApp = admin.initializeApp({
credential: <setup-credentials>
),
databaseURL: 'https://something.firebaseio.com'
})
adminApp
.firestore()
.collection('someCollection')
.onSnapshot(
{
includeMetadataChanges: true
},
onNextCallback,
onErrorCallback
)
Describe the problem
Firebase reference documentation states that you can have an options object as the first argument for the
DocumentReference.onShapshot()method. This works for thefirebaseJavaScript client SDK, but not for this Node.js SDK.Specifying an options object for this package produces the following error:
Based on what I could tell, the problem is that this method is only expecting the first argument to be the
onNextfunction:This code is actually in the
@google-cloud/firestore/build/src/reference.jspackage, but that does not seem to be publicly available apart from via this repo.Steps to reproduce:
Relevant Code: