Meteor Method not found in 1.3

/imports/api/users/methods.js

import { Meteor } from 'meteor/meteor';

Meteor.methods({
  'Users.sendVerificationLink'() {
    let userId = Meteor.userId();
    if ( userId ) {
      return Accounts.sendVerificationEmail( userId );
    }
  }
});

And here’s where I’m calling the method:

/imports/ui/pages/RegisterPage.jsx

import React from 'react';
import { Meteor } from 'meteor/meteor';

export default class RegisterPage extends React.Component {
  signupWithEmail(event) {
    Accounts.createUser(user, (error) => {
      if (error) {
        sweetAlert("Oops...", error, "error");
      } else {
        Meteor.call('Users.sendVerificationLink', (error, response) => {
          if (error) {
            sweetAlert("Oops...", error, "error");
          } else {
            sweetAlert("Welcome", "Your account is complete!", "success");
          }
        });
      }
    });

    event.preventDefault();
  }
}

Is this a load order issue? I’m sure it’s related to that or something, any ideas guys?

I’m getting this error message:

Method ‘Users.sendVerificationLink’ not found [404]

Did you correctly import your methods file to the server?
Thats usually when this happens :slight_smile:

Thanks for the assist - can you be a bit more specific? I posted all the relevant code I have, so I’m not sure what I would need to import.

take a look at this react todos app, notice how in the server file relevant methods get imported at the start

1 Like

server calls imports/startup/server/index which calls register-api.js

Thats the file which import the methods to the server

1 Like

Ah I gotcha. Makes sense now. :rocket: Thank you!

1 Like