kurdin/console-remote-server

Problems deploying on production

gbishop opened this issue · 28 comments

I'm trying to get the server exposed to the world so that I can debug with a remote user. If I try with console.re it tells me I should be using a private server.

I'm following the instructions but I can't quite get things going. I've got the node server running on 8088. I've got nginx proxying to it. I've got the contents of the build directory at my server root.

I can access the server at https://gb.cs.unc.edu and it shows my host properly (now, I had that broken).

I'm successfully talking to the server.

On the client side, when I use the script tag

    <script
      src="https://gb.cs.unc.edu/connector.js"
      data-server="https://gb.cs.unc.edu/"
      data-channel="Speech"
      id="consolerescript"
    ></script>

I get an error in the browser console

Uncaught TypeError: Cannot read property 'server' of undefined
    at Object.87 (connector.js:formatted:22)
    at __webpack_require__ (connector.js:formatted:3743)
    at Object.568 (connector.js:formatted:649)
    at __webpack_require__ (connector.js:formatted:3743)
    at connector.js:formatted:3764
    at connector.js:formatted:3767
    at connector.js:formatted:3
    at connector.js:formatted:4

I'm sure I'm missing something but I can't tell what.

If I import and call consolere.connect I can get the js loaded but it apparently does nothing. Looking in the network tab I don't see it attempt to connect to my server.

@gbishop I just tested your setup and server with connection script you provided and I can connect and send logs to your server's channel.

in my local HTML I added

    <script
      src="https://gb.cs.unc.edu/connector.js"
      data-server="https://gb.cs.unc.edu"
      data-channel="Speech"
      id="consolerescript"
    ></script>

I removed / from the end of data-server="https://gb.cs.unc.edu" but it does not matter.

image

I reload page and I can send logs just fine to https://gb.cs.unc.edu/Speech

May-15-2021.16-48-23.mp4

Wow! Thanks for the quick and complete response. But... I'm still missing something.

My console at https://gb.cs.unc.edu/Speech shows I'm connected but I don't get any output.

The page I am using for testing is here: https://gb.cs.unc.edu/~gb/tmp/iosSpeech/index.html

OK. It is starting to dawn on me. You're using a local file. Yes, when I copy my html local and open it then all works.

How do I make it work on a page that is accessible from the internet?

When I use the network tab I can see it accessing the socket.io when I open the file locally. When I open it remotely, I get no activity at all. It never attempts to access the server.

I did hack connector.js to move the isLocal test below the definition of consoleReOptions because I was getting Uncaught TypeError: Cannot read property 'server' of undefined.

It behaves the same in Firefox.

If I force "isLocal" to true, it works.

@gbishop if you look close to console there is a warning

consoleRe [warning] seems like you trying to use console remote on public, production server. 
Console.Re is for light, local development only, for production you can install and use self hosted solution https://console.re/#self-hosted-server
a.connectIO @ connector.js:398
index.html:91 

I thought I fix that on remote server repo but seems like not, let me see if I can quickly find a fix for it

If I force "isLocal" to true, it works.

yes

@gbishop can you try using this connector script https://console.re/connector.js seems like I fixed that version but did not push update to this repo

 <script
      src="https://console.re/connector.js"
      data-server="https://gb.cs.unc.edu"
      data-channel="Speech"
      id="consolerescript"
    ></script>

That behaves the same for me.

@gbishop ok, thanks for trying, lets comeback to this problem tomorrow

Yes, my brain is crashing. Tomorrow is another day.

Yes, my brain is crashing. Tomorrow is another day.

you did set server up correctly, the problem in on my side, so thank you for the report and we'll fix it tomorrow.

@gbishop
I have updated connector script with isPrivate check, please try use it directly from console.re server

<script
      src="https://console.re/connector.js?2.1.16"
      data-server="https://gb.cs.unc.edu"
      data-channel="Speech"
      id="consolerescript"
    ></script>

or you can update your local console-remote-server version

ok, keep it please on your server like this, I'll push another update. It is working fine on console.re, strange

Possibly because I'm setting redirect?

<script
  src="https://console.re/connector.js?2.1.16"
  data-server="https://gb.cs.unc.edu"
  data-channel="Speech"
  data-options="redirectDefaultConsoleToRemote"
  id="consolerescript"
></script>

Yes, it is, but should work, I have the same option enabled on runjs and no errors: https://runjs.co/QmMmaKXuK

@gbishop please update to 2.1.17
src="https://console.re/connector.js?2.1.17"

Seems to be working now.

@gbishop thanks for reporting.

Thanks for this great software!

@gbishop do you want me to delete this issue, so no one can take advantage of your remote console private server ? :)

sounds good!