Livvy Jeffs
Livvy Jeffs

Reputation: 159

MeteorJS -- Internal server error [500] -- No Data

I implemented a fully scaffolded Meteor project, and removed 'autopublish', and when I try to call even this simple function:

Meteor.methods({
    'test'(){
        alert('test called');
    },
});

I get the error:

Error invoking Method 'test': Internal server error [500]

I try calling another Method which doesn't even call an error, which is why I stripped down the function to the bare minimum.

All other solutions I look for talk about subscribing to databases, except I've taken all that information out -- what could be causing this error and how can I fix it?

Upvotes: 1

Views: 132

Answers (1)

Mostafiz Rahman
Mostafiz Rahman

Reputation: 8562

This should throw an error, because Meteor.methods is run in server and alert is not defined in server side. alert is available in client side only. If you look at the server log you will find this: Exception while invoking method 'a' ReferenceError: alert is not defined.

If you are trying to print something in server side use console.log instead. In your case;

Meteor.methods({
    'test'(){
        console.log('test called');
    },
});

Upvotes: 3

Related Questions