You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.
I'm trying to delete child (Trip) in raw-bus location (Firebase) after 10 seconds. But getting errors in code, still learning node js. Any help is much appreciated.
// Change the panel once every ten seconds
this.timeTimerId = setInterval(() => {
this.deleteChild();
}, 10000);
}
deleteChild(){
this.cutoff = this.timeRef - 10000;
this.oldItemsQuery = this.rawBusLocationsRef.orderByChild('timestamp').endAt(this.cutoff);
return this.oldItemsQuery.once('value').then((snapshot) => {
// create a map with all children that need to be removed
const updates = {};
snapshot.forEach(child => {updates[child.key] = null;});
// execute all updates in one go and return the result to end the function
return this.rawBusLocationsRef.update(updates);
});
}};
and the error is:
/*
Error: Query.endAt failed: first argument contains NaN in property 'raw-bus-location'
at validateFirebaseData (/home/maphilak/server4r/node_modules/@firebase/database/dist/index.nod
e.cjs.js:1443:15)
at validateFirebaseDataArg (/home/maphilak/server4r/node_modules/@firebase/database/dist/index.
node.cjs.js:1421:5)
at Query.endAt (/home/maphilak/server4r/node_modules/@firebase/database/dist/index.node.cjs.js:
4985:9)
at exports.DeleteChild.deleteChild (/home/maphilak/server4r/delete_child.js:23:74)
at Timeout.timeTimerId.setInterval [as _onTimeout] (/home/maphilak/server4r/delete_child.js:16:
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! transport-tracker-server@1.0.0 main: node main.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the transport-tracker-server@1.0.0 main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/maphilak/.npm/_logs/2018-11-30T10_50_04_443Z-debug.log
*/
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!
On Fri, 4 Oct 2019 at 01:04, stale[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
recent activity. Please comment here if it is still valid so that we can
reprioritize. Thank you!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#58?email_source=notifications&email_token=AJGZA4BLSOHQLGUQDVJJSO3QMZ26BA5CNFSM4GHN2KS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAJ3HPY#issuecomment-538162111>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJGZA4ADRD6TLFEUERW5IBTQMZ26BANCNFSM4GHN2KSQ>
.
I'm trying to delete child (Trip) in raw-bus location (Firebase) after 10 seconds. But getting errors in code, still learning node js. Any help is much appreciated.
exports.DeleteChild = class {
constructor(timeRef, rawBusLocationsRef, cutoff, oldItemsQuery ){
this.timeRef = timeRef;
this.rawBusLocationsRef = rawBusLocationsRef;
this.cutoff = cutoff;
this.oldItemsQuery = oldItemsQuery;
}
deleteChild(){
this.cutoff = this.timeRef - 10000;
this.oldItemsQuery = this.rawBusLocationsRef.orderByChild('timestamp').endAt(this.cutoff);
return this.oldItemsQuery.once('value').then((snapshot) => {
// create a map with all children that need to be removed
const updates = {};
snapshot.forEach(child => {updates[child.key] = null;});
// execute all updates in one go and return the result to end the function
return this.rawBusLocationsRef.update(updates);
});
}};
and the error is:
/*
at validateFirebaseData (/home/maphilak/server4r/node_modules/@firebase/database/dist/index.nod
e.cjs.js:1443:15)
at validateFirebaseDataArg (/home/maphilak/server4r/node_modules/@firebase/database/dist/index.
node.cjs.js:1421:5)
at Query.endAt (/home/maphilak/server4r/node_modules/@firebase/database/dist/index.node.cjs.js:
4985:9)
at exports.DeleteChild.deleteChild (/home/maphilak/server4r/delete_child.js:23:74)
at Timeout.timeTimerId.setInterval [as _onTimeout] (/home/maphilak/server4r/delete_child.js:16:
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! transport-tracker-server@1.0.0 main:
node main.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the transport-tracker-server@1.0.0 main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/maphilak/.npm/_logs/2018-11-30T10_50_04_443Z-debug.log
*/
The text was updated successfully, but these errors were encountered: