Closed jwngr closed 7 years ago
Note that you can use the new Admin Node.js SDK with Firebase Queue today, even before we switch out the underlying dependency. Instead of:
// my_queue_worker.js
var Queue = require('firebase-queue');
var firebase = require('firebase');
firebase.initializeApp({
serviceAccount: 'path/to/serviceAccountCredentials.json',
databaseURL: '<your-database-url>'
});
var ref = firebase.database().ref('queue');
var queue = new Queue(ref, function(data, progress, resolve, reject) {
// ...
});
You would do:
// my_queue_worker.js
var Queue = require('firebase-queue');
var admin = require('firebase-admin'); // CHANGED
admin.initializeApp({ // CHANGED
credential: admin.credential.cert('path/to/serviceAccountCredentials.json'), // CHANGED
databaseURL: '<your-database-url>'
});
var ref = admin.database().ref('queue'); // CHANGED
var queue = new Queue(ref, function(data, progress, resolve, reject) {
// ...
});
After talking with @drtriumph, our plan is to do the following:
firebase
by using the sentinel value ({".sv": "timestamp"}
) instead of firebase.database.ServerValue.TIMESTAMP
.firebase
and firebase-admin
in optionalDepenencies
instead of peerDependencies
. That way, people can use Firebase Queue with either the firebase
or firebase-admin
module and it is not a breaking change for existing users.I recently developed a firebase queue backend which is yet to go on a production and though I am stuck! Thanks 😄
Now that the Firebase Admin Node.js SDK is available, we should switch the dependency for Firebase Queue from
firebase
tofirebase-admin
.