TypeError: Cannot read property 'curr_uid' of undefined at exports.sendNotification.functions.database.ref.onWrite.event [duplicate]Firebase TypeError: Cannot read property 'val' of undefinedFirebase functions: cannot read property 'user_id' of undefinedDetecting an undefined object propertyHow to check empty/undefined/null string in JavaScript?How can I merge properties of two JavaScript objects dynamically?How do I remove a property from a JavaScript object?Sort array of objects by string property valueHow to determine if variable is 'undefined' or 'null'?How to check for “undefined” in JavaScript?Read environment variables in Node.jsIs there a standard function to check for null, undefined, or blank variables in JavaScript?Iterate through object properties
When should IGNORE_DUP_KEY option be used on an index?
How do German speakers decide what should be on the left side of the verb?
Book where main character comes out of stasis bubble
Are there mathematical concepts that exist in the fourth dimension, but not in the third dimension?
What is the name for quantum gates that can be reversed?
Can I create AWS Keys for each user that expire every 2 weeks?
Remaining in the US beyond VWP admission period
What quests do you need to stop at before you make an enemy of a faction for each faction?
Draw the ☣ (Biohazard Symbol)
What are some countries where you can be imprisoned for reading or owning a Bible?
I won a car in a poker game. How is that taxed in Canada?
Project Euler Problem 45
How could a planet have one hemisphere way warmer than the other without the planet being tidally locked?
What would happen if you robbed the momentum from a falling object?
In-universe, why does Doc Brown program the time machine to go to 1955?
What is the justification for Dirac's large numbers hypothesis?
What's this constructed number's starter?
What's the connection between a spoon (匕) and the old age (⺹)? (Kanji: 老)
extract specific cheracters from each line
Why are some hotels asking you to book through Booking.com instead of matching the price at the front desk?
Do 643,000 Americans go bankrupt every year due to medical bills?
What drugs were used in England during the High Middle Ages?
Golfball Dimples on spaceships (and planes)?
Was the lunar landing site always in the same plane as the CM's orbit?
TypeError: Cannot read property 'curr_uid' of undefined at exports.sendNotification.functions.database.ref.onWrite.event [duplicate]
Firebase TypeError: Cannot read property 'val' of undefinedFirebase functions: cannot read property 'user_id' of undefinedDetecting an undefined object propertyHow to check empty/undefined/null string in JavaScript?How can I merge properties of two JavaScript objects dynamically?How do I remove a property from a JavaScript object?Sort array of objects by string property valueHow to determine if variable is 'undefined' or 'null'?How to check for “undefined” in JavaScript?Read environment variables in Node.jsIs there a standard function to check for null, undefined, or blank variables in JavaScript?Iterate through object properties
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
This question already has an answer here:
Firebase functions: cannot read property 'user_id' of undefined
1 answer
Firebase TypeError: Cannot read property 'val' of undefined
2 answers
I am writing a program to get the value of a current user ID from inside Notifications node of firebase. From there I want to fetch the details of that user whose ID is stored in the Notification node. But I am getting the error of cannot read property of curr_uid of undefined
This is my index.js file
const functions = require('firebase-functions');
const admin = require ('firebase-admin');
admin.initializeApp (functions.config().firebase);
exports.sendNotification = functions.database.ref('/Notifications/curr_uid').onWrite(event =>
const curr_uid = event.params.curr_uid;
console.log ('uid',curr_uid);
return admin.database().ref('Notifications/curr_uid').once('value').then(snapshot =>
if(snapshot.exists())
const sender_uid = snapshot.val().By;
console.log('New notification from ',sender_uid);
);
const payload =
notification:
title: "New Post",
body: "A new post is added",
icon: "default"
;
return admin.database().ref('Tokens').once('value').then(allToken =>
if(allToken.val())
console.log('token available');
const token = Object.keys(allToken.val());
return admin.messaging().sendToDevice(token,payload);
else
console.log('No token available');
);
);
I expect to send push notification to all devices when a current user id childnode is added to Notifications node for that curr_uid
. I want to fetch "By" child key and value inside that curr_uid
node so that i can use it later to send notifications by user's name.
This is the Notifications Node in my firebase database
javascript node.js firebase
marked as duplicate by Peter Haddad
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 28 at 6:31
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Firebase functions: cannot read property 'user_id' of undefined
1 answer
Firebase TypeError: Cannot read property 'val' of undefined
2 answers
I am writing a program to get the value of a current user ID from inside Notifications node of firebase. From there I want to fetch the details of that user whose ID is stored in the Notification node. But I am getting the error of cannot read property of curr_uid of undefined
This is my index.js file
const functions = require('firebase-functions');
const admin = require ('firebase-admin');
admin.initializeApp (functions.config().firebase);
exports.sendNotification = functions.database.ref('/Notifications/curr_uid').onWrite(event =>
const curr_uid = event.params.curr_uid;
console.log ('uid',curr_uid);
return admin.database().ref('Notifications/curr_uid').once('value').then(snapshot =>
if(snapshot.exists())
const sender_uid = snapshot.val().By;
console.log('New notification from ',sender_uid);
);
const payload =
notification:
title: "New Post",
body: "A new post is added",
icon: "default"
;
return admin.database().ref('Tokens').once('value').then(allToken =>
if(allToken.val())
console.log('token available');
const token = Object.keys(allToken.val());
return admin.messaging().sendToDevice(token,payload);
else
console.log('No token available');
);
);
I expect to send push notification to all devices when a current user id childnode is added to Notifications node for that curr_uid
. I want to fetch "By" child key and value inside that curr_uid
node so that i can use it later to send notifications by user's name.
This is the Notifications Node in my firebase database
javascript node.js firebase
marked as duplicate by Peter Haddad
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 28 at 6:31
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Try to log the event parameter and check if curr_uid is there or not.
– RopAli Munshi
Mar 28 at 5:01
Are you using some old documentation or tutorial? The API for onWrite functions changed quite a while ago. firebase.google.com/docs/reference/functions/…
– Doug Stevenson
Mar 28 at 5:05
Yes i am using a old tutorial
– shivali shrivastava
Mar 28 at 5:08
Ok thanks i will refer this for my cloud function
– shivali shrivastava
Mar 28 at 5:10
add a comment |
This question already has an answer here:
Firebase functions: cannot read property 'user_id' of undefined
1 answer
Firebase TypeError: Cannot read property 'val' of undefined
2 answers
I am writing a program to get the value of a current user ID from inside Notifications node of firebase. From there I want to fetch the details of that user whose ID is stored in the Notification node. But I am getting the error of cannot read property of curr_uid of undefined
This is my index.js file
const functions = require('firebase-functions');
const admin = require ('firebase-admin');
admin.initializeApp (functions.config().firebase);
exports.sendNotification = functions.database.ref('/Notifications/curr_uid').onWrite(event =>
const curr_uid = event.params.curr_uid;
console.log ('uid',curr_uid);
return admin.database().ref('Notifications/curr_uid').once('value').then(snapshot =>
if(snapshot.exists())
const sender_uid = snapshot.val().By;
console.log('New notification from ',sender_uid);
);
const payload =
notification:
title: "New Post",
body: "A new post is added",
icon: "default"
;
return admin.database().ref('Tokens').once('value').then(allToken =>
if(allToken.val())
console.log('token available');
const token = Object.keys(allToken.val());
return admin.messaging().sendToDevice(token,payload);
else
console.log('No token available');
);
);
I expect to send push notification to all devices when a current user id childnode is added to Notifications node for that curr_uid
. I want to fetch "By" child key and value inside that curr_uid
node so that i can use it later to send notifications by user's name.
This is the Notifications Node in my firebase database
javascript node.js firebase
This question already has an answer here:
Firebase functions: cannot read property 'user_id' of undefined
1 answer
Firebase TypeError: Cannot read property 'val' of undefined
2 answers
I am writing a program to get the value of a current user ID from inside Notifications node of firebase. From there I want to fetch the details of that user whose ID is stored in the Notification node. But I am getting the error of cannot read property of curr_uid of undefined
This is my index.js file
const functions = require('firebase-functions');
const admin = require ('firebase-admin');
admin.initializeApp (functions.config().firebase);
exports.sendNotification = functions.database.ref('/Notifications/curr_uid').onWrite(event =>
const curr_uid = event.params.curr_uid;
console.log ('uid',curr_uid);
return admin.database().ref('Notifications/curr_uid').once('value').then(snapshot =>
if(snapshot.exists())
const sender_uid = snapshot.val().By;
console.log('New notification from ',sender_uid);
);
const payload =
notification:
title: "New Post",
body: "A new post is added",
icon: "default"
;
return admin.database().ref('Tokens').once('value').then(allToken =>
if(allToken.val())
console.log('token available');
const token = Object.keys(allToken.val());
return admin.messaging().sendToDevice(token,payload);
else
console.log('No token available');
);
);
I expect to send push notification to all devices when a current user id childnode is added to Notifications node for that curr_uid
. I want to fetch "By" child key and value inside that curr_uid
node so that i can use it later to send notifications by user's name.
This is the Notifications Node in my firebase database
This question already has an answer here:
Firebase functions: cannot read property 'user_id' of undefined
1 answer
Firebase TypeError: Cannot read property 'val' of undefined
2 answers
javascript node.js firebase
javascript node.js firebase
edited Mar 28 at 5:13
Midhun Darvin
1,05212 silver badges22 bronze badges
1,05212 silver badges22 bronze badges
asked Mar 28 at 4:58
shivali shrivastavashivali shrivastava
12 bronze badges
12 bronze badges
marked as duplicate by Peter Haddad
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 28 at 6:31
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Peter Haddad
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 28 at 6:31
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Peter Haddad
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 28 at 6:31
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Try to log the event parameter and check if curr_uid is there or not.
– RopAli Munshi
Mar 28 at 5:01
Are you using some old documentation or tutorial? The API for onWrite functions changed quite a while ago. firebase.google.com/docs/reference/functions/…
– Doug Stevenson
Mar 28 at 5:05
Yes i am using a old tutorial
– shivali shrivastava
Mar 28 at 5:08
Ok thanks i will refer this for my cloud function
– shivali shrivastava
Mar 28 at 5:10
add a comment |
Try to log the event parameter and check if curr_uid is there or not.
– RopAli Munshi
Mar 28 at 5:01
Are you using some old documentation or tutorial? The API for onWrite functions changed quite a while ago. firebase.google.com/docs/reference/functions/…
– Doug Stevenson
Mar 28 at 5:05
Yes i am using a old tutorial
– shivali shrivastava
Mar 28 at 5:08
Ok thanks i will refer this for my cloud function
– shivali shrivastava
Mar 28 at 5:10
Try to log the event parameter and check if curr_uid is there or not.
– RopAli Munshi
Mar 28 at 5:01
Try to log the event parameter and check if curr_uid is there or not.
– RopAli Munshi
Mar 28 at 5:01
Are you using some old documentation or tutorial? The API for onWrite functions changed quite a while ago. firebase.google.com/docs/reference/functions/…
– Doug Stevenson
Mar 28 at 5:05
Are you using some old documentation or tutorial? The API for onWrite functions changed quite a while ago. firebase.google.com/docs/reference/functions/…
– Doug Stevenson
Mar 28 at 5:05
Yes i am using a old tutorial
– shivali shrivastava
Mar 28 at 5:08
Yes i am using a old tutorial
– shivali shrivastava
Mar 28 at 5:08
Ok thanks i will refer this for my cloud function
– shivali shrivastava
Mar 28 at 5:10
Ok thanks i will refer this for my cloud function
– shivali shrivastava
Mar 28 at 5:10
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Try to log the event parameter and check if curr_uid is there or not.
– RopAli Munshi
Mar 28 at 5:01
Are you using some old documentation or tutorial? The API for onWrite functions changed quite a while ago. firebase.google.com/docs/reference/functions/…
– Doug Stevenson
Mar 28 at 5:05
Yes i am using a old tutorial
– shivali shrivastava
Mar 28 at 5:08
Ok thanks i will refer this for my cloud function
– shivali shrivastava
Mar 28 at 5:10