Hi,
I’m trying to setup various account-related functionality like sending verification emails and password reset emails.
I have signed up with SendGrid and added my MAIL_URL config. This appears to be working as I can send an email using Email.send(…).
However, whenever I try to use the Accounts functions, I get an error:
Exception while invoking method 'users.sendVerificationEmail' Error: After filtering out keys not in the schema, your modifier is now empty.
This is happening on the client side (using Accounts.forgotPassword) and server side (using Accounts.sendVerificationEmail). I think it might be something related to my users schema but I have no idea what.
This is my users schema:
UserSchema = new SimpleSchema(
{
username: { type: String, required: true },
services: Object,
'services.password': Object,
'services.password.bcrypt': String,
'services.resume': { type: Object, blackbox: true },
emails: { type: Array, label: "Email Addresses" },
'emails.$': Object,
'emails.$.address': String,
'emails.$.verified': Boolean,
createdAt: Date,
profile: { type: Object, blackbox: true },
...
},
{ tracker: Tracker, requiredByDefault: false }
);
This is my server side method:
"users.sendVerificationEmail": async (userId) => {
if(Meteor.isServer) {
console.log(userId)
Accounts.sendVerificationEmail(userId);
}
},
The userId parameter is being filled correctly (i.e. it’s not undefined or anything) - the console.log shows the id.
The full error stack trace is:
Exception while invoking method 'users.sendVerificationEmail' Error: After filtering out keys not in the schema, your modifier is now empty
I20201112-08:53:42.104(0)? at doValidate (packages/aldeed:collection2/collection2.js:432:11)
I20201112-08:53:42.104(0)? at Collection.Mongo.Collection.<computed> [as update] (packages/aldeed:collection2/collection2.js:200:14)
I20201112-08:53:42.104(0)? at AccountsServer.Accounts.generateVerificationToken (packages/accounts-password/password_server.js:705:16)
I20201112-08:53:42.104(0)? at AccountsServer.Accounts.sendVerificationEmail (packages/accounts-password/password_server.js:914:14)
I20201112-08:53:42.104(0)? at imports/db/users/methods.js:51:16
What am I missing?