node.jsherokuprobot

Show probot logs in Heroku


In a simple Probot app (GitHub App) that is deployed to Heroku, I want to show log messages in the Heroku logs. I'm using the app reference as in the default examples in the Probot docs.

app.log('Yay, the app was loaded!');

I changed the log level in heroku which didn't help either. When started locally via npm start it works (logs are shown in the console).

I also tried:

console.log('Yay...');
app.log.info('Yay...');

Question: How can I see logs in Heroku from within a Probot app?


Solution

  • Found the issue. Probot didn't actually start up because I didn't set the environment variables as described in the documentation.

    Configure the Heroku app, replacing the APP_ID and WEBHOOK_SECRET with the values > for those variables, and setting the path for the PRIVATE_KEY:

    $ heroku config:set APP_ID=aaa \
         WEBHOOK_SECRET=bbb \
         PRIVATE_KEY="$(cat ~/Downloads/*.private-key.pem)"
    

    I guess APP_ID is the important one.