Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heroku scheduler with node.js file #44

Open
dhavaln opened this issue Dec 22, 2015 · 2 comments
Open

heroku scheduler with node.js file #44

dhavaln opened this issue Dec 22, 2015 · 2 comments

Comments

@dhavaln
Copy link

dhavaln commented Dec 22, 2015

So I want to run a periodic job with Heroku Scheduler but the job fails every time with following message.

ReferenceError: require is not defined`

This is the code I am running in scheduler file schedulerTest:

var http = require('http');

var options = {
    host: 'sometesturl.herokuapp.com',
    port: 80,
    path: '/api/schedulertest',
    method: 'GET'
};

http.request(options, function(res) {
        res.on('data', function (chunk) {
            console.log('BODY: ' + chunk);
        });
}).end();
@rfines
Copy link

rfines commented Jan 22, 2016

Is this inside of a Meteor App? If so, you should not have to require anything as the http module is already included in Meteor Core. Take a look at this post by the Meteor Chef:
https://themeteorchef.com/snippets/using-the-http-package/

@rfines
Copy link

rfines commented Jan 22, 2016

Also you could use something like the SyncedCron package to run scheduled tasks inside of a meteor app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants