Meteor 1.7.0.1 + WebSockets fail on Ubuntu 18.04?

#1

Is it just me, or does Meteor 1.7.0.1 not play nice on Ubuntu 18.04?

Using Linux’s Virtual Machine Manager AND a Digital Ocean droplet, I installed a fresh copy of Ubuntu 18.04 server. Then:

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install nginx
curl https://install.meteor.com/ | sh
meteor create simple-todos
cd simple-todos
meteor

Open up this server at port 3000, I get the following error:

browser.js:169 WebSocket connection to 'ws://localhost:3000/websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Tried:

  • changing my node version to 8.11.2
  • seting a location / proxy to localhost:3000 in Nginx conf
  • ufw allow 3000

But nothing had any effect. Is it just me?

Firefox and Chrome give me the same error, so I assume it’s not a browser issue. Had no problems running and launching Meteor apps in previous versions.

I tried installing an old version of Meteor via curl "https://install.meteor.com/?release=1.6.1.2" | sh but I got a 403 error.

Any ideas welcome.

#2

You don’t need Nginx to run Meteor.
I’ve just tested on my Ubuntu 18.04 without any problem:

meteor create --full test1
Created a new Meteor app in ‘test1’.

To run your new app:
cd test1
meteor

If you are new to Meteor, try some of the learning resources here:
https://www.meteor.com/tutorials

meteor
[[[[[ ~/WORKS/Test/test1 ]]]]]

=> Started proxy.
=> Started MongoDB.
=> Started your app.

=> App running at: http://localhost:3000/

#3

If you do want to run Meteor behind nginx, you’ll need to set nginx up to pass through the correct headers:

This guide on the nginx doc explains:
https://nginx.org/en/docs/http/websocket.html

Example:

location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}
#4

Take a look at this issue on Github - https://github.com/meteor/meteor/issues/9928

Some have suggesting using the IP address of your computer to access it in the browser.

#5

I’m constantly dev meteor 1.6-1.7 on local ubuntu 18 with nginx and don’t have any problems

#6

@aminhas @coagmano yes, thanks, already have that, just omitted those details for the sake of brevity. I have an older version of Meteor running behind Nginx as a reverse proxy in a production system already, I find it faster to serve static assets directly via Nginx, among other things.

@jh65592 yes, that looks like it could be it – will give it a shot. ty

@orloff ok, thanks, good to know it’s just me and my setup.

1 Like