Updating to latest Firebase SDK to causes tests to fail in quickstart/uppercase
See original GitHub issueSteps to reproduce
- Upgrade libraries to the latest Firebase SDK in /quickstarts/uppercase/functions/package.json
...
"dependencies": {
"firebase-admin": "5.4.3",
"firebase-functions": "0.7.1"
},
...
- Run
npm install
- Run
npm run test
Expected behavior
Tests should pass
Actual behavior
The tests fail with the following error message. As far as I can tell, this was introduced by the 5.5.0 version of firebase-admin. The tests do not fail on version 5.4.3.
The devDependency libraries are also really out-of-date, but updating them to the latest chai, mocha and sinon does not fix the problem.
> mocha --reporter spec
Cloud Functions
makeUpperCase
Uppercasing undefined null
1) should upper case input and write it to /uppercase
addMessage
2) should return a 303 redirect
0 passing (312ms)
2 failing
1) Cloud Functions makeUpperCase should upper case input and write it to /uppercase:
TypeError: Cannot read property 'toUpperCase' of null
at exports.makeUppercase.functions.database.ref.onWrite.event (index.js:57:33)
at Object.<anonymous> (node_modules/firebase-functions/lib/cloud-functions.js:59:27)
at Generator.next (<anonymous>)
at node_modules/firebase-functions/lib/cloud-functions.js:28:71
at __awaiter (node_modules/firebase-functions/lib/cloud-functions.js:24:12)
at Object.cloudFunction [as makeUppercase] (node_modules/firebase-functions/lib/cloud-functions.js:53:36)
at Context.it (test/test.js:112:50)
2) Cloud Functions addMessage should return a 303 redirect:
TypeError: Attempted to wrap undefined property database as function
at checkWrappedMethod (node_modules/sinon/lib/sinon/util/core.js:78:29)
at Object.wrapMethod (node_modules/sinon/lib/sinon/util/core.js:129:21)
at Object.stub (node_modules/sinon/lib/sinon/stub.js:67:26)
at Context.it (test/test.js:130:28)
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (14 by maintainers)
Top Results From Across the Web
Firebase Apple SDK Release Notes - Google
Fixed a zip distribution issue where the Promises module caused linking to fail (#10071). Limited dependency on GTMSessionFetcher version to < 2.1.0 to...
Read more >Unable to run the unit tests after integrating Firebase SDK ...
I have solved the problem by adding FirebaseInstanceID Framework to my target(click on the framework and check if its has been added to...
Read more >firebase_core | Flutter Package - Pub.dev
Flutter plugin for Firebase Core, enabling connecting to multiple ... FEAT: update Firebase Android SDK to 28.3.1 & Firebase iOS SDK to 8.6.0...
Read more >ref().update() from within onComplete callback causes [Error
firebase.database().ref().update(updates); }); })(i); }. When I run this from a Node JS server (v4.4.3) with Firebase JS SDK v3.1.0 I see the following...
Read more >Firestore pod failing after update - Hacking with Swift
I recentlly updated my pod files (pod update) which i have for over a year with my app. I am now getting this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok I was able to get it to work.
First you need the latest version of sinon:
Then change the way we stub
admin.database
because it is a getter and not a property:Change test.js L.131 from:
to:
I’ll try to get the docs updated tomorrow.
I had the same problem. In the makeUpperCase test. The DeltaSnapshot interface has changed with the new update. It now requires an extra parameter ‘instance’. To make the test pass change line 84 from
data: new functions.database.DeltaSnapshot(null, null, null, 'input'),
todata: new functions.database.DeltaSnapshot(null, null, null, null, 'input'),
I have not looked into why addMessage fails.