简体   繁体   中英

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?

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');
    },
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM