montagejs / collections

This package contains JavaScript implementations of common data structures with idiomatic interfaces.
http://www.collectionsjs.com
Other
2.09k stars 185 forks source link

row.toArray is not a function while use where or orderBy function #229

Open freddy5566 opened 4 years ago

freddy5566 commented 4 years ago

Environment details

Steps to reproduce

  1. const testFirebase = functions.https.onRequest(
    async (req, res): Promise<void> => {
    console.log(JSON.stringify(req.body));
    
    const foo = firestore.collection('foo');
    const where = foo.where('num', '==', 0);
    const coll = await where.get();
    res.sendStatus(200);
    }
    );
    export default testFirebase;
  2. and import it in index.ts and in the index I also declare different cloud function

it will give me the error message

TypeError: row.toArray is not a function
at Function.Array.unzip (/Users/jamfly/my-project/functions/node_modules/collections/shim-array.js:38:24)
at Array.GenericCollection.zip
(/Users/jamfly/my-projectfunctions/node_modules/collections/generic-collection.js:206:18)
at Array.GenericOrder.equals
(/Users/jamfly/my-project/functions/node_modules/collections/generic-order.js:22:14)
at Array.<anonymous> (/Users/jamfly/my-project/functions/node_modules/collections/shim-array.js:290:46)
    at Object.equals (/Users/jamfly/my-project/functions/node_modules/collections/shim-object.js:364:18)
    at Array.<anonymous> (/Users/jamfly/my-project/functions/node_modules/collections/shim-array.js:138:30)
        at coalesce
        (/Users/jamfly/my-project/functions/node_modules/@google-cloud/firestore/build/src/reference.js:1857:19)
        at QueryOptions.with
        (/Users/jamfly/my-project/functions/node_modules/@google-cloud/firestore/build/src/reference.js:826:189)
        at CollectionReference.where
        (/Users/jamfly/my-project/functions/node_modules/@google-cloud/firestore/build/src/reference.js:965:48)
        at testOrderBy (/Users/jamfly/my-project/functions/lib/test-firebase.js:10:23)
        at functions.https.onRequest (/Users/jamfly/my-project/functions/lib/test-firebase.js:18:11)
        at Run
        (/Users/jamfly/.nvm/versions/node/v10.16.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:608:20)
        at
        /Users/jamfly/.nvm/versions/node/v10.16.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:582:19
        at Generator.next (<anonymous>)
            at
            /Users/jamfly/.nvm/versions/node/v10.16.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:7:71
            at new Promise (<anonymous>)
                at __awaiter
                (/Users/jamfly/.nvm/versions/node/v10.16.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:3:12)
                at Run
                (/Users/jamfly/.nvm/versions/node/v10.16.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:575:12)
                at
                /Users/jamfly/.nvm/versions/node/v10.16.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:607:15
                at Generator.next (<anonymous>)
                    at
                    /Users/jamfly/.nvm/versions/node/v10.16.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:7:71
                    at new Promise (<anonymous>)

I guess it possibly is the conflict of package, so, here is my dependencies

"dependencies": {
    "@google-cloud/bigquery": "4.1.4",
    "@google-cloud/firestore": "2.2.3",
    "@google-cloud/logging": "5.1.3",
    "@google/maps": "^0.5.5",
    "@line/bot-sdk": "^6.8.0",
    "@sendgrid/mail": "^6.4.0",
    "@types/json2csv": "^4.4.0",
    "@types/mysql": "^2.15.5",
    "@types/qrcode": "^1.3.2",
    "actions-on-google": "^2.9.1",
    "base64-img": "^1.0.4",
    "canvas": "2.1.0",
    "chart.js": "2.7.2",
    "cors": "^2.8.4",
    "dialogflow": "^0.10.2",
    "dialogflow-fulfillment": "^0.6.1",
    "excel-export": "^0.4.1",
    "exif": "^0.6.0",
    "express": "^4.17.1",
    "firebase-admin": "8.5.0",
    "firebase-functions": "^3.2.0",
    "google-auth-library": "^2.0.2",
    "googleapis": "^41.0.1",
    "grpc": "^1.21.1",
    "iconv": "2.3.4",
    "image-size": "0.7.4",
    "jsdom": "13.0.0",
    "json2csv": "^4.5.1",
    "lodash": "^4.17.15",
    "moment": "2.22.2",
    "moment-timezone": "^0.5.26",
    "mysql": "^2.17.1",
    "promise-mysql": "3.3.2",
    "pureimage": "0.1.6",
    "qrcode": "^1.3.3",
    "request": "^2.88.0",
    "request-promise": "^4.2.2",
    "sharp": "0.22.0",
    "text-to-picture": "1.0.0",
    "uuid": "3.3.2"
  },

Thanks!

ref: https://github.com/googleapis/nodejs-firestore/issues/761