Meteor.call causing 500 error and method undefined server side

I have been developing a Meteor & Angular application and so far everything was going well. Yesterday I made some changes, deployed the application to Galaxy, and things started to go wrong.

I noticed the client side error error invoking Method 'myMethod': Internal server error [500] so I went and checked out the logs and found Exception while invoking method 'myMethod' undefined. I wasn’t able to recreate these errors locally, and everything on my development machine appeared to be working fine.

This was the first time I had experienced this and have been working on this application for several months now. I first attempted to redeploy to Galaxy guessing that something may have gone wrong in the deployment process. This did not solve the problem. I then started looking to see what version of Meteor Galaxy may be running and couldn’t find an answer. I did see that Meteor had several new releases, so I thought I would try updating to the latest.

I first updated to 1.3.5.1 as recommended in the Migrating to Meteor 1.4 guide. Running locally everything continued to work correctly. Great, but I was still unsure why things wouldn’t be working when deployed to Galaxy :confused: I then upgraded to Meteor 1.4. Things went kind of smoothly but I was able to get everything working.

Running my application with meteor 1.4 I am able to recreate the error locally, though I am still unsure why Meteor is not picking up on my registered methods.

My directory structure is :

.
├── README.md
├── bower.json
├── client
│   └── ...
├── config
│   ├── development.json
│   ├── localhost.json
│   └── production.json
├── models
│   ├── facebookAccounts.js
│   ├── facebookBusinesses.js
│   └── users.js
├── mongo.sh
├── package.json
├── packages
│   └── npm-container
│       ├── index.js
│       └── package.js
├── packages.json
├── public
│   └── ...
└── server
    ├── accounts.js
    ├── config.js
    ├── email.js
    ├── hooks.js
    ├── publish.js
    └── startup.js

Where startup.js contains :

'use strict';

console.log('Ding');

FBGraph.setVersion('2.5');
FBGraph.get = Meteor.wrapAsync(FBGraph.get);

console.log('Ding');

const mailChimp = new MailChimp(Meteor.settings.mailChimp.apiKey, {version: '2.0'});

console.log('Ding');

Meteor.methods({
  myMethod: function() {
    // do some Facebook API stuff
  },
});

On startup Ding is console.loged multiple times implying that this file is being execute, though Meteor.call('myMethod') client side is causing the above listed errors.

Some Additional Info :

Meteor Version : 1.4.0.1

(let me know if there is further details that would be useful)

Since you’re getting a 500 error, that means your Meteor Method is being called and found. If it couldn’t be found then you’d see something like:

Error invoking Method 'invalidMethod': Method 'invalidMethod' not found [404]

It sounds like something is happening within your Method. Can you post your Method source?

You are correct @hwillson. I used (node-inspector)[https://github.com/node-inspector/node-inspector] and was able to step through my method execution and resolve the problem. Sorry for the confusion on my part.