ECONNREFUSED for the Public API port

@bbrks

We are trying to set up Sync Gateway 3.1 and we are unable to make the Rest API work.

We are getting this error message when we try to connect using Postman.

GET http://XX.XX.XXX.XXX:4984/_all_dbs
Error: connect ECONNREFUSED XX.XX.XXX.XXX:4984

After reviewing this Bootstrap Configuration | Couchbase Docs
, we added the API section as mentioned.

Do we need to add the API section in the bootstrap file for the Rest API to work?

I have added the Sync Gateway Configuration that we are using.

Any pointer will be helpful.

Thanks!!

{
	"bootstrap": {
		"server": "couchbases://XX.XXX.XX.XXX",
		"username": "XXXXXXXXXX",
		"password": "XXXXXXXXXX",
		"server_tls_skip_verify": true,
		"use_tls_server": true
	},
	"api": {
      "admin_interface": "127.0.0.1:4985",
      "admin_interface_authentication": false,
      "compress_responses": true,
      "enable_advanced_auth_dp": true,
      "hide_product_version": true,
      "idle_timeout": "30s",
      "max_connections": 5,
      "metric_interface": "127.0.0.1:4986",
      "metrics_interface_authentication": false,
      "pretty": true,
      "profile_interface": "127.0.0.1:4984",
      "public_interface": "127.0.0.1:4984",
      "read_header_timeout": "30s",
      "server_read_timeout": "30s",
      "server_write_timeout": "30s"
   },
	"logging": {
		"log_file_path": "/var/tmp/sglogs",
		"redaction_level": "partial",
		"console": {
			"log_level": "none",
			"log_keys": [
				"*"
			]
		},
		"error": {
			"enabled": true,
			"rotation": {
				"max_size": 20,
				"max_age": 180
			}
		},
		"warn": {
			"enabled": true,
			"rotation": {
				"max_size": 20,
				"max_age": 90
			}
		},
		"info": {
			"enabled": false
		},
		"debug": {
			"enabled": false
		}
	}
}

ECONNREFUSED indicates that nothing is listening on the address and port.

You might need further help from a sync gateway person with the configuration and the ip address to use.

Your bootstrap config is set up in a way that will only listen on localhost for all of the given ports SG runs on (4984, 4985, 4986)

Change "public_interface": "127.0.0.1:4984", to "public_interface": ":4984", if you want this port to be accessible beyond the local network of the host it’s running on.

The default values should be adequate for this. Described here:

The precise format and available options for the _interface configs is inherited from Go’s net package describing the address parameter:

For TCP networks, if the host in the address parameter is empty or a literal unspecified IP address, Listen listens on all available unicast and anycast IP addresses of the local system. To only use IPv4, use network “tcp4”. The address can use a host name, but this is not recommended, because it will create a listener for at most one of the host’s IP addresses. If the port in the address parameter is empty or “0”, as in “127.0.0.1:” or “[::1]:0”, a port number is automatically chosen. The Addr method of Listener can be used to discover the chosen port.