Firebase Functions for Firestore Failing due to NanoMatch Issue

自古美人都是妖i 提交于 2019-12-03 16:30:13

问题


I am new to cloud functions and was testing this sample code https://github.com/firebase/functions-samples/tree/master/quickstarts/uppercase-firestore This fails to execute due to an error from nanomatch. Looking at nanomatch repository on GitHub This is a listed issue and reverting back to 1.2.9 takes care of this error.

I am trying to fix this on my end - but how do I do this? Can somebody guide me on this. Thank you for the help.

TypeError: Cannot read property 'addQmark' of undefined
    at Object.<anonymous> (/user_code/node_modules/firebase-admin/node_modules/nanomatch/lib/compilers.js:92:15)
    at Object.visit (/user_code/node_modules/firebase-admin/node_modules/snapdragon/lib/compiler.js:129:15)
    at Object.mapVisit (/user_code/node_modules/firebase-admin/node_modules/snapdragon/lib/compiler.js:143:12)
    at Object.compile (/user_code/node_modules/firebase-admin/node_modules/snapdragon/lib/compiler.js:168:10)
    at Snapdragon.compile (/user_code/node_modules/firebase-admin/node_modules/snapdragon/index.js:156:32)
    at /user_code/node_modules/firebase-admin/node_modules/micromatch/index.js:786:23
    at memoize (/user_code/node_modules/firebase-admin/node_modules/micromatch/index.js:859:13)
    at Function.micromatch.compile (/user_code/node_modules/firebase-admin/node_modules/micromatch/index.js:783:10)
    at create (/user_code/node_modules/firebase-admin/node_modules/micromatch/index.js:686:25)
    at /user_code/node_modules/firebase-admin/node_modules/micromatch/index.js:695:16

回答1:


THIS BUG WAS FIXED

The version that caused the bug was reverted right when this issue was reported on GitHub, which was within minutes of it being released. To get the fix, just reinstall. You might need to delete node_modules and/or lockfiles first, to ensure cached versions aren't used by NPM. This conversation belongs on GitHub, so that we can respond to user feedback. I found this by chance. StackOverflow is not for support).

Edit 2: it appears that firebase-admin itself needs to re-install dependencies as well. I'm looking into how to make that happen.

Please report and check issues on GitHub, where the codebase is and where this discussion belongs.

Visit https://github.com/micromatch/nanomatch/issues/15 for more info.




回答2:


Faced the same problem "Thumbnail URL not saved to firestore. Cannot read property 'addQmark' of undefined" Started today morning when I upgraded to the latest firebase-tools@3.19.1 At first thought was issue with my code, but after rollbacking my code the situation persisted. Rolled back to firebase-tools@3.19.0 and the situation got fixed. There is a bug in the latest firebase-tools




回答3:


Use this:

npm install nanomatch@1.2.9 -S




回答4:


just rollback to older version npm install -g firebase-tools@3.19.0




回答5:


Firebase team is probably/hopefully redeploying all functions without the broken nanomatch package, but for me following the advice from @abhi and redeploying immediately solved the issue!

npm install nanomatch@1.2.9 -S
firebase deploy --only functions

(npm install in the functions folder!)



来源:https://stackoverflow.com/questions/51055137/firebase-functions-for-firestore-failing-due-to-nanomatch-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!