I’ve followed CodeQueen’s tutorial ( https://support.totallycodable.com/en/article/send-email-notification-using-sendgrid-npm-and-wix-code ) to trigger e-mails upon submission of a custom form, but am receiving the following error in the console:
“Hook afterInsert for collection WorkshopForm result ignored! Expected hook result to resolve to an object with an ‘_id’ property, but got [Undefined]”.
This is my data.js code (I used my own e-mail addresses under “to” and “from” to test it out):
…and my SendGrid template has the variables {{firstName}}, {{lastName}}, and {{email}} in the body, which are also field names in the data collection.
I’ve set up the hook for the data collection as described, and the permission is set to “Form Submission”. Does anyone have any idea what the problem might be?