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

Peerjs server deployed on heroku is not working #207

Open
Chhinna opened this issue Jul 27, 2020 · 15 comments
Open

Peerjs server deployed on heroku is not working #207

Chhinna opened this issue Jul 27, 2020 · 15 comments

Comments

@Chhinna
Copy link

Chhinna commented Jul 27, 2020

I used the deploy on Heroku button from this link to deploy a peerjs server. To connect to this server I used

const peer = new Peer(host: 'focusmonk-beta.herokuapp.com', port:9000, path:'/')

But this is not working, am I missing something ?

@veerareddyvishal144
Copy link

That's because the default password is wrong. Trying to find a fix

@RamyaAshika
Copy link

Any update on this, its saying connected but not receiving connection on two peers ? @vishalveerareddy @Chhinna

@ElmouradiAmine
Copy link

you need to use the port 443 I had the same issue. But I encountered another one :(. Due to security issues I cannot send my getUserMedia stream over the peer js connection.

@siddharthmagadum16
Copy link

I'm facing a similar issue. Is there any fix for this or not?
The request for https://<server-name>.herokuapp.com:9000/peer-server/peerjs/id?ts=16312062773910.47823913209901503 is failing due to CORS request did not succeed error.
How to fix this?

@blyzniuk
Copy link

I'm facing a similar issue. Is there any fix for this or not?
The request for https://<server-name>.herokuapp.com:9000/peer-server/peerjs/id?ts=16312062773910.47823913209901503 is failing due to CORS request did not succeed error.
How to fix this?

As Amine said above, you need to set 433 port in your url when you use https connection, or 80 port for http. This is default TCP ports.

@siddharthmagadum16
Copy link

siddharthmagadum16 commented Sep 26, 2021

I'm facing a similar issue. Is there any fix for this or not?
The request for https://<server-name>.herokuapp.com:9000/peer-server/peerjs/id?ts=16312062773910.47823913209901503 is failing due to CORS request did not succeed error.
How to fix this?

As Amine said above, you need to set 433 port in your url when you use https connection, or 80 port for http. This is default TCP ports.

Yeah, we need to use port 443, otherwise, it won't work. I ended up using the 0.peerjs.com peer cloud server which runs on port 443 instead of creating my own peer server.

@zaidm124
Copy link

I am getting this error,
GET https://https//realtime-notepad-voice.herokuapp.com/:433/peerjs/peerjs/id?ts=16351849542150.5264754979506276 net::ERR_NAME_NOT_RESOLVED.

I have set the port to 433 still i am getting this error. It works fine on local host, but when i deploy on heroku i get this error.
I also found this in the headers.
Referrer Policy: strict-origin-when-cross-origin

@siddharthmagadum16
Copy link

@zaidm124 I have solved this issue using peer cloud instead of my own peer server.
peer cloud server: https://0.peerjs.com.
I think you actually can't set reserved ports, and Heroku assigns random ports.
If you still want to make your own peer server, you need to use Nginx to use reserved ports as far as I have heard while I encountered this issue.

@blyzniuk
Copy link

blyzniuk commented Oct 25, 2021

I am getting this error, GET https://https//realtime-notepad-voice.herokuapp.com/:433/peerjs/peerjs/id?ts=16351849542150.5264754979506276 net::ERR_NAME_NOT_RESOLVED.

I have set the port to 433 still i am getting this error. It works fine on local host, but when i deploy on heroku i get this error. I also found this in the headers. Referrer Policy: strict-origin-when-cross-origin

Have you seen your request url? It's completely broken
There should be https://realtime-notepad-voice.herokuapp.com:433/peerjs..., but you have https://https//realtime-notepad-voice.herokuapp.com/:433/peerjs/

@zaidm124
Copy link

I am getting this error, GET https://https//realtime-notepad-voice.herokuapp.com/:433/peerjs/peerjs/id?ts=16351849542150.5264754979506276 net::ERR_NAME_NOT_RESOLVED.
I have set the port to 433 still i am getting this error. It works fine on local host, but when i deploy on heroku i get this error. I also found this in the headers. Referrer Policy: strict-origin-when-cross-origin

Have you seen your request url? It's completely broken There should be https://realtime-notepad-voice.herokuapp.com:433/peerjs..., but you have https://https//realtime-notepad-voice.herokuapp.com/:433/peerjs/

but i have copied that url from the console, i dont think i can correct that

@siddharthmagadum16
Copy link

siddharthmagadum16 commented Oct 25, 2021

I am getting this error, GET https://https//realtime-notepad-voice.herokuapp.com/:433/peerjs/peerjs/id?ts=16351849542150.5264754979506276 net::ERR_NAME_NOT_RESOLVED.

I have set the port to 433 still i am getting this error. It works fine on local host, but when i deploy on heroku i get this error. I also found this in the headers. Referrer Policy: strict-origin-when-cross-origin

Here is the frontend code for using peer cloud server.

import Peer from "peerjs";
const myPeer = new Peer(undefined, {
    key: "peerjs",
    debug: 2,
    secure: process.env.REACT_APP_ENV === "PRODUCTION" ? true : false, // secure : false for http connection
  });

you can refer more in the docs https://peerjs.com/docs.html#start

@blyzniuk
Copy link

@zaidm124 Can you share how do you connect to peerjs on the client side?

My configuration for custom peerjs server on heroku:

server (part of my express app):

const peerServer = ExpressPeerServer(httpServer)
expressApp.use('/peerjs', peerServer)

client:

new Peer(userInfo.uid, {
    path: '/peerjs',
    host: '/',
    port: '433', // 433 for https, 80 for http
  })

@zaidm124
Copy link

@zaidm124 Can you share how do you connect to peerjs on the client side?

My configuration for custom peerjs server on heroku:

server (part of my express app):

const peerServer = ExpressPeerServer(httpServer)
expressApp.use('/peerjs', peerServer)

client:

new Peer(userInfo.uid, {
    path: '/peerjs',
    host: '/',
    port: '433', // 433 for https, 80 for http
  })

let peer = new Peer(undefined, {
path: '/peerjs',
secure: true,
host: 'https://realtime-notepad-voice.herokuapp.com/',
port: '433',
});

This is what i did

@siddharthmagadum16
Copy link

This may be helpful : #9 for someone

@zaidm124
Copy link

Thank you so much everyone, the problem is solved for me now. Peer cloud server worked. Thank you again @blyzniuk @siddharthmagadum16

I am getting this error, GET https://https//realtime-notepad-voice.herokuapp.com/:433/peerjs/peerjs/id?ts=16351849542150.5264754979506276 net::ERR_NAME_NOT_RESOLVED.
I have set the port to 433 still i am getting this error. It works fine on local host, but when i deploy on heroku i get this error. I also found this in the headers. Referrer Policy: strict-origin-when-cross-origin

Here is the frontend code for using peer cloud server.

import Peer from "peerjs";
const myPeer = new Peer(undefined, {
    key: "peerjs",
    debug: 2,
    secure: process.env.REACT_APP_ENV === "PRODUCTION" ? true : false, // secure : false for http connection
  });

you can refer more in the docs https://peerjs.com/docs.html#start

This worked for me, thank you so much for helping me out.

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

No branches or pull requests

9 participants