-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SendEmail: Cannot read property 'id' of undefined #15
Comments
Hi, |
Hello Sir!
Thank You for coming back to me on this.
So far I have found that event.ref.id gives you order id. However
event.data doesn’t give you the order object.
Would be great if you find a solution.
…On Sat, 23 Jun 2018 at 07:48, Stoyan Delev ***@***.***> wrote:
Hi,
Just checked on my demo website, and also didn't work, maybe something
changed in firebase functions or firestore since they are still beta and
made this half year ago.
Will try to find what courses the problem but that might take me some time.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjgDppnNJLJsScyeRlDMeiYEYaB-vlFhks5t_eTWgaJpZM4Uy76y>
.
|
Hello, This link proved very useful in getting sendEmail () to work: https://firebase.google.com/docs/functions/beta-v1-diff#cloud-firestore Essentially I had to run the following commands:
|
Thanks, that looks great, can you create PR? |
After checkout API successfully completes, I can see that the DB triggers call to send email. However this is reporting the following error:
TypeError: Cannot read property 'id' of undefined
at exports.sendEmail.functions.firestore.document.onCreate.event (/user_code/index.js:49:31)
at Object. (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:112:27)
at next (native)
at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71
at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12)
at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:82:36)
at /var/tmp/worker/worker.js:728:24
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
When I look at the firestore database, I see the 'id' has been added, but it's inside the product's structure which is odd, should it not be at the root of the document?
Another error I get is:
TypeError: event.data.data is not a function
at exports.sendEmail.functions.firestore.document.onCreate.event (/user_code/index.js:50:27)
at Object. (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:112:27)
at next (native)
at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71
at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12)
at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:82:36)
at /var/tmp/worker/worker.js:728:24
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
The text was updated successfully, but these errors were encountered: