I have a Google AppScript that appends one single row to a Google Sheet. The post works fine when I use Postman, and the row is added as expected. Now I am using Firebase Functions to post in an onCreate. In node.js:
exports.userOnCreate = functions.firestore.document('User/{uid}').onCreate(async (userSnap, context) => {
if (userSnap.data().subscribe) {
const data = {
submittedOn: Date.now(),
email: userSnap.data().email,
};
await axios.post(GOOGLE_SHEETS_SUBSCRIBE, data)
.then((res) => {
console.log(`Status: ${res.status}`);
console.log('Body: ', res.data);
}).
catch((err) => {
console.error(err);
})
}
});
My Functions log shows it returns with a status of 200, but the row is not added. In my AppScript executions log, it shows Running for 60 seconds, and then updates to Unknown status.
I have 'execute the app as me', and 'allow access to anyone, even anonymous.'
Please help! Thank you.