Comments (5)
Some fields are updated by Cloud Functions. You might have to deploy them in your Firebase project to make this work. Using the command firebase deploy --only functions
should do the trick.
from app.
Thank you for your fast response. I think I have all functions in firebase up to date. There is a function called processVotes
in my dashboard what should do the magic. It is the only function marked as Trigger ref.write
the others are all HTTP Anfrage
(I think request
).
from app.
I think I found the root of the issue. Due to an misconfiguration of firebase, I had two realtime databases. One in europe-west1 (my standard db) and one in us-central1 where the functions live too (I think I created the second one because of a mismatch of the region of the functions and the db. But I'm not sure).
All data was written to the second db (us-cetnral1). But the function processVotes
watched changes and would like to write in the first db. So it didn't do anything and no vote count was updated for the tracks. I close the issue because of the configuration failure.
I read in the firebase documentation changing the default db of firebase is not possible. And it seems the key for databaseURL
in firebase.config.js
only affects the other functions. So I'm trying to change the use of the other db in the code. In order to archive that I changed:
export const processVotes = functions.database.ref('/votes/{partyId}/{trackId}/{userId}')
to
export const processVotes = functions.database.instance('my-second-db').ref('/votes/{partyId}/{trackId}/{userId}')
and I think it's a working approach because my log statements in this function are now executed. Sadly the next db accesses
const topmostTrack = firebase.database()
.ref('/tracks')
.child(partyId)
.limitToFirst(1)
.orderByChild('order')
.once('value');
and
firebase.database()
.ref('/tracks')
.child(partyId)
.child(trackId)
.transaction(...)
are referring to the wrong db. I was assuming the firebase.database()
statement is taking the database from the firebase.config.js
. But in the google console logs I found:
[2022-06-20T21:18:01.066Z] @firebase/database: FIREBASE WARNING: The Firebase database 'my-first-db-default-rtdb' has been disabled by a database owner. (https://my-first-db-default-rtdb.europe-west1.firebasedatabase.app/)
I don't know why only this functions want to use the old standard db and not the new one.
from app.
My final workaround is now overwriting the databaseURL
in index.ts
.
let config = JSON.parse(process.env.FIREBASE_CONFIG!);
// tslint:disable-next-line:no-var-requires
const serviceAccount = require('./service-account.json');
config["databaseURL"] = "https://my-second-db.firebaseio.com/";
firebase.initializeApp({
...config,
credential: firebase.credential.cert(serviceAccount),
});
Obviously the line let config = JSON.parse(process.env.FIREBASE_CONFIG!);
loads an outdated configuration file. But I don't find one in my workspace with the old value for the databaseURL
. In my firebase.config.js
the value for the key is correct. So for now, I have no issues with your awesome pice of software. Thank you very much, I will donate something.
from app.
Thanks for writing up your findings @dnlkng. Although I had the same symptoms as you (with a different cause), it still helped me towards finding my issue!
When looking in my functions console log I had something very similar to this StackOverflow thread:
TypeError: Cannot read property 'name' of undefined at dataConstructor (/workspace/node_modules/firebase-functions/lib/providers/database.js:137:85) at cloudFunctionNewSignature (/workspace/node_modules/firebase-functions/lib/cloud-functions.js:119:34) at cloudFunction (/workspace/node_modules/firebase-functions/lib/cloud-functions.js:151:20) at Promise.resolve.then (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:198:28) at process._tickCallback (internal/process/next_tick.js:68:7)
In the end, the fix that worked for me was ensuring the following was set in functions/package.json
:
"engines": {
"node": "16"
}
And also updating firebase-functions
and deps to latest:
cd functions
yarn upgrade firebase-functions@latest firebase-admin@latest typescript@latest
npm run deploy
Hope this helps anyone else who was in a similar boat to me.
from app.
Related Issues (20)
- Unable to create party HOT 5
- Unable to add explicit tracks to the queue, HOT 2
- Festify play one song, then stop playing after the song has ended HOT 9
- Additional sources for fallback playlist HOT 1
- Is Festify now broken? HOT 2
- Festify autopauses HOT 3
- Spotify sunset in libspotify HOT 1
- Playback is broken or inconsistent. HOT 9
- Festify is glitching - beginning of track is looping and unable to skip songs HOT 4
- Share button doesn't work HOT 3
- Unable to create party: CORS blocked HOT 1
- Music stops after errors in console (screenshot) HOT 3
- Skipping through songs HOT 9
- HowTo Install HOT 1
- Add QR code for the party URL to the TV Mode screen
- [feature request] button to disable adding new songs HOT 3
- Stop after first song finished HOT 9
- question acordding festify.us HOT 1
- Songs skipping until queue is empty HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from app.