Show probot logs in Heroku - node.js

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?

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.

Related

WebRtc with nodeJS and react

WebRTC work only in local subnet but after deploy to Heroku stop working correctly. I can not recieve data.
const PC_CONFIG = { 'iceServers': [{url:'stun:stun.l.google.com:19302'} ] };
github code
if you are having issues with Heroku, use the Heroku deploy template listed on the Github Code: .
If you still have errors, please run heroku logs --tail and paste the logs so we can help further.

db-migrate for node-postgres in next.js app not finding env variables on heroku

I'm trying to run db-migrate for postgres on heroku but cannot seem to figure out why it doesn't have the right env variables. Hoping for some guidance if someone else has encountered a similar problem.
I created a next.js app. Locally, I have a .env file with DATABASE_URL, etc. The app and migrations work just fine.
I pushed my app to heroku. The env variables are all defined in the heroku app config vars, so the app is working as expected. However, when I try to run db-migrate up or down, I get "Could not find database config file '/app/database.json'". I looked at the source and this only happens when process.env.DATABASE_URL is not defined. However, it is in my heroku app config vars, so I am confused as to why the migration cannot find the database URL. I thought the config vars would be pushed into node's process.env.
I am working around this by creating a new .env file in heroku every time I deploy but would prefer to fix this properly.

When I use my Heroku Config Variables in my react app, they come back as undefined

I've built a simple resume website using react; hosted on heroku, its code can be found here. I am using a service emailjs to allow others to reach me via email. Locally I am using config/secrets.json to load variables I need to initiate the emailjs object. I added all variables contained in config/secrets.json to my heroku app located at Settings Config Vars.
You can see how I attempt to access those environment variables here.
When I take a look at the console, I see that process.env.INIT_USER outputs undefined? I have INIT_USER in my heroku app and see it on the cli with command heroku config -a app_name.
I cannot access my environment variables despite the fact that I see them on my herokus app settings.
My application is deployed in Heroku and I use Heroku Pipelines for my deployment and build process.
If you set the ENV vars in heroku after deploying the app, try redeploying the app.
With a create-react-app app (which uses buildpack), I found that the process.env variables were set during the build phase of the deployment. So, updating the variables in the heroku dashboard after the build was completed did not update the variables in the process.env object. Redeploying the app updated the process.env object with the env variables I had set.
This also causes problems with pipelines because Heroku does not rebuild the app slug when you promote it to production. This means the promoted app will use the process.env variables from your staging app, so you have to make sure your staging app has the same variables that you want to use in production.
Big design flaw on Heroku's part IMO.
I had to actually uninstall my globally installed create-react-app:
npm uninstall -g create-react-app
and opt for this app generation command instead:
npx create-react-app myapp

'heroku local' cannot find module 'load-foreman-procfile'

I'm trying to run Heroku applications locally via 'heroku local,' but a missing module error is occurring in the Heroku CLI. Is this a Heroku bug that just needs to be reported or is there something wrong with how things have been setup on my machine (mac)? Any suggestions are appreciated.
In order to ensure my application isn't the problem, I've been debugging this issue with the node application Heroku provides in its getting started guides. Meaning, it already has a Procfile that can be run using default settings.
Things I've tried:
Re-install node modules for both application and CLI
Re-install the Heroku CLI
Here's the error:
node-js-getting-started [master] :> heroku local
Error: Cannot find module '../../load-foreman-procfile'
at Object.<anonymous> (/usr/local/Cellar/heroku/7.26.1/libexec/node_modules/#heroku-cli/plugin-local/lib/commands/local/index.js:5:18)
The file for the route above requires a 'load-foreman-procfile' like so:
const Procfile = require('../../load-foreman-procfile');
That require path doesn't lead to a to file by that name. In fact, this is the only reference to 'load-foreman-procfile' I can find in '/usr/local/Cellar/heroku/7.26.1'.
Rather than the error code above, I would expect heroku local to yield a running local server started via my Procfile.
I got the same error running heroku-cli v7.26.0. I switched to their edge channel (currently v7.26.2) and heroku local worked for me after that.
like #sophon mentioned - updating from v7.26.0 to v7.26.2 solved this for me. heroku update on mac did the trick.

Run heroku-cli command in heroku-based application

I'm trying to delete heroku application from another heroku web-appication
There is a bash-script: heroku apps:destroy ${APP_NAME} --confirm ${APP_NAME}
Locally it works fine because I have installed heroku-toolbelt; but on heroku-server I get an error: 'heroku: not found'
Is it possible to work with heroku-cli from heroku-based apps?
You can use the heroku toolbelt buildpack, which provides the toolbelt alongside your application:
https://github.com/gregburek/heroku-buildpack-toolbelt
You can also use the heroku API directly from your app:
https://devcenter.heroku.com/categories/platform-api

Resources