WebRtc with nodeJS and react - node.js

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.

Related

node js server deployment on heroku

we are working on a video call application, we used nodejs and socket io for the server. We have arrived at the deployment phase. When deploying the server on heroku it displays Build succeeded but when I launch the link or I click on open app leads to a white page where is written :
Cannot GET /
Any help please
I tried to replace the port process.env.SOCKET_BACKEND_URL || "http://localhost:5000"
bye by the link given while deployment:
process.env.SOCKET_BACKEND_URL ||"https://appname.herokuapp.com/"

How do I deploy NodeJS server that's for a React Native App to Heroku?

I have an app using React Native as its frontend, and NodeJS as backend, and it also has a cloud MySQL instance. I want to deploy the app to the public and show it to someone as demo using Heroku or maybe other hosting services.
I want to publish my React Native App with Expo, but am not sure how/ where to host my nodeJS server so that the mobile app can access it.
Steps for deploying React native/expo app to heroku:
1: set heroku buildpack as static: >heroku buildpacks:set heroku-community/static
2: Add static.json for static buildtype: { "root": "web-build/", "routes": { "/**": "index.html" } } More settings here: https://github.com/heroku/heroku-buildpack-static#configuration
3: npm run build (package.json: "build": "expo build:web") --> Creates web-build folder
git add .
git commit
git push heroku master
heroku open
You can follow Heroku official document to deploy your NodeJS server.
https://devcenter.heroku.com/articles/deploying-nodejs
Then you can access the domain provided by Heroku just exactly like on your localhost.

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?
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.

nodejs and express with heroku im getting R10

thanks for taking time to help me
im deploying a nodejs express js project
these are the steps that i have done:
1- change the port to: process.env.PORT
code:
const PORT = process.env.PORT || 9000;
app.listen(PORT , function() {
console.log('Application is listening on 9000');
});
2- create Procfile with: web: node server.js
3- make sure in package json the npm start command points to "node path/server.js"
the server works locally
4- important note: I am sending an AJAX request from my front end to the server to get data
I have read on you documentation that i should add 0.0.0.0
$.ajax({
url: "0.0.0.0/hotels",
cache: false,
type: 'GET',
success: function(result) {
bla bla ....
}
});
also i have tried to add the url of heroku the one i get after creating
thanks in advance
have a great day
did not solve it yet but i organized some helpful heroku commands
useful commands
git remote -v
git remote rm heroku
heroku create
git push heroku master
heroku ps:scale web=1
heroku open
heroku logs --tail
heroku run bash
Your code there looks fine (except 0.0.0.0 -- just use a relative path like /). I would ensure you've actually pushed the changes you have there. If you run heroku run bash, do you see your Procfile? When you run node server.js in that environment, does it run successfully?
I've seen Heroku customers get stuck on an issue like this, when the reality is that the code they have locally wasn't properly sent to Heroku.
Hello #jmccartie thank you for replying but it still does not work
could it be the static __dirname? im starting to question every part of the code :D
I changed the path and just to make sure i understood correctly
it used to be : "http://localhost:9000/data/hotels"
now is: "/data/hotels"
would you mind taking a look at my code?
just double check the parts i mentioned
https://github.com/hibaAkroush/herokuNode
i will name the files to make it easier for you
1- Procfile in the root
2- server in server/index.js line 24
3- the front end (where im sending an ajax get request) client/home.js line 6
4- packagejson line 10: "start": "node server/index.js"
thanks
ok i fixed it ...
wohoo!
not sure which thing i made fixed it
but what i did was:
1- I moved the server to the root and of course changed the code a bit so it would still work than i tested it locally to make sure
2- pushed on github
3- added ./ to procfile so it became
web: node ./index.js
instead of web: node index.js
thanks everyone !

What heroku Procfile for parse server

Completely new to heroku, profiles and node.js. I'm running Parse Server hosted on Heroku and I'm trying to get kue running in order to do scheduled jobs.
To achieve that I need to add a worker. And to do that, I need a Procfile. But I don't know what to put in it.
This seems to work fine :
web: node index.js
worker: node queue.js
Where index.js is the index.js file of parse server and I have my queue related code in queue.js. Hope it'll help !

Resources