Getting error 403 in Firebase Storage as well as getting error in firebase funcions
ReferenceError: error is not defined at admin.database.ref.once.then.then.then.then (/user_code/index.js:78:32) at process._tickDomainCallback (internal/process/next_tick.js:135:7)
Here is the Actual Code
// Add a payment source (card) for a user by writing a stripe payment source token to Realtime database
exports.addPaymentSource = functions.database
.ref('/stripe_customers/{userId}/sources/{pushId}/token').onWrite((change, context) => {
const source = change.after.val();
if (source === null){
return null;
}
return admin.database().ref(/stripe_customers/${context.params.userId}/customer_id)
.once('value').then((snapshot) => {
return snapshot.val();
}).then((customer) => {
return stripe.customers.createSource(customer, {source});
}).then((response) => {
return change.after.ref.parent.set(response);
}, (error) => {
return change.after.ref.parent.child('error').set(userFacingMessage(error));
}).then(() => {
return reportError(error, {user: context.params.userId});
});
});
Getting error 403 in Firebase Storage as well as getting error in firebase funcions
ReferenceError: error is not defined at admin.database.ref.once.then.then.then.then (/user_code/index.js:78:32) at process._tickDomainCallback (internal/process/next_tick.js:135:7)