Error: Could not connect to the API server

Hello,

No matter what I do (including starting over with a clean server), I cannot get beyond the “Could not connect to the API server” error message on the first screen, after trying to submit my registration form.

I have now spent hours trying the various solutions I found in this forum and in one github issue.

I’m trying out the various tools in this space to see which would suit us best. All the other ones installed without any issues…

Would love to try out Baserow, because I think it might suit us best, but this is getting so difficult, I’m about to give up.

Please help.

Thank you kindly.

Hi @db1 ,

Sorry to hear you are having problems. Could you please let us know:

  • What exactly you are trying to install Baserow on. The exact specifications would help the most.
  • What exact steps are you trying to follow?
  • How exactly are you trying to access your Baserow server? From a remote computer? Is it running behind a reverse proxy?

Hi @nigel ,

Thanks for getting back to me!

The operating system is: Ubuntu 20.04.5 LTS

I’m following your instructions from the official Baserow install page: https://baserow.io/docs/installation/install-on-ubuntu

Drawing on this, this is how I start the container:

docker run -e BASEROW_PUBLIC_URL=http://localhost \
--name baserow \
-d \
--restart unless-stopped \
-v baserow_data:/baserow/data \
-p 80:80 \
-p 443:443 \
baserow/baserow:1.12.0

I am trying to access Baserow from a remote computer via a VPN, using a custom hostname simply called ‘crm’ (the custom hostname works, as the initial Baserow page loads fine).

However, maybe the issue is related to the custom host? When I try to open the API url http://crm:8080/api/user/, I get the following error (with debugging on):

# DisallowedHost at /api/user/
Invalid HTTP_HOST header: 'crm:8080'. You may need to add 'crm' to ALLOWED_HOSTS.

Not quite sure what to do… Thank you for any help again!

Hi @db1 you need to change BASEROW_PUBLIC_URL to the url that you visit baserow on in your browser. In this case it should be http://crm:8080/.

After a first run with Docker Compose/Portainer

I’m Also getting: “Network error Could not connect to the API server.”

I have tried a few different variations of the Docker Compose config

I can reach the site via subdomain.domain and https is working via LetsEncrypt but always get the API error.
Any help appreciated

Config:

version: “3.4”
services:
baserow:
container_name: baserow-mywebsite
image: baserow/baserow:1.14.0
environment:
BASEROW_PUBLIC_URL: ‘http://10.0.50.147:8080
BASEROW_CADDY_ADDRESSES: ‘https://baserow.mywebsite.co.uk’ (also tried 443 here)
ports:
- “8080:80”
- “443:443”
volumes:
- baserow_data:/baserow/data
volumes:
baserow_data:

BASEROW_PUBLIC_URL needs to be https://baserow.mywebsite.co.uk/. In other words BASEROW_PUBLIC_URL needs to be the URL you are typing into your browser to access your website.

Thanks, I eventually got it working.
I had to set it the same for both, It wouldn’t work without the BASEROW_CADDY_ADDRESS.
Had to use both. Wouldn’t work with just the Public_URL
BASEROW_PUBLIC_URL: ‘https://baserow.mysite.co.uk
BASEROW_CADDY_ADDRESSES: ‘https://baserow.mysite.co.uk

I’m running into this with a basic Docker deploy. It’s running behind an nginx reverse proxy for TLS though. Is there some special flag that should be set in that configuration?

Hey,
thanks for reaching out.
Try to follow this steps:
https://baserow.io/docs/installation/install-behind-nginx

The documentation doesn’t cover the case where the Nginx server is serving TLS but baserow isn’t covered. I’m running many other services behind this proxy with no problem, but Baserow is giving me massive headaches.

In addition to copying the configs provided and testing some additional proxy headers, I’ve tried every combination of the following:
With the public url pointed to HTTP/HTTPS
With the caddy address pointed to HTTP/HTTPS
With and without the caddy address
Proxying nginx TLS to baserow HTTP
Proxying nginx TLS to baserow TLS

As expected, most of the combinations result in proxy errors. But the few that do load the login page all result in the API server error above.

Hey Tiz,
what kind of outputs you get when you try to curl / openssl the endpoint?

[edit: this worked:

docker run -d --name baserow -e BASEROW_PUBLIC_URL=http://192.168.12.44 -v baserow_data:/baserow/data -p 80:80 --restart unless-stopped baserow/baserow:1.20.2

]

I am having the same issue. I used:

docker run -d --name baserow -e BASEROW_PUBLIC_URL=https://192.168.12.44/ -v baserow_data:/baserow/data -p 80:80 --network=host --restart unless-stopped baserow/baserow:1.20.2

and am able to connect and get the signup screen. When I submit the form, I get the same error the OP got.

Then I tried using http: instead of https://. Then, the error became “Action not completed.
The action couldn’t be completed because an unknown error has occurred.”

No one has posted the errors in the inspector console. Maybe they’ll help. Here are errors from both https: setup in docker and http:.

POST https://192.168.12.44//api/user/ net::ERR_CONNECTION_REFUSED
(anonymous) @ 4d694e5.js:2
xhr @ 4d694e5.js:2
Z @ 4d694e5.js:2
Promise.then (async)
value @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
register @ 8d92fc1.js:1
(anonymous) @ 8d92fc1.js:1
y @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
r @ 4d694e5.js:2
l @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
register @ 8d92fc1.js:1
(anonymous) @ 4d694e5.js:2
m.dispatch @ 4d694e5.js:2
dispatch @ 4d694e5.js:2
(anonymous) @ b7d4a19.js:1
y @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
r @ 4d694e5.js:2
l @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
register @ b7d4a19.js:1
submit @ b7d4a19.js:1
on @ 4d694e5.js:2
n @ 4d694e5.js:2
Io.c._wrapper @ 4d694e5.js:2

and with http:

POST http://192.168.12.44//api/user/ 404 (Not Found)
(anonymous) @ 4d694e5.js:2
xhr @ 4d694e5.js:2
Z @ 4d694e5.js:2
Promise.then (async)
value @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
register @ 8d92fc1.js:1
(anonymous) @ 8d92fc1.js:1
y @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
r @ 4d694e5.js:2
l @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
register @ 8d92fc1.js:1
(anonymous) @ 4d694e5.js:2
m.dispatch @ 4d694e5.js:2
dispatch @ 4d694e5.js:2
(anonymous) @ b7d4a19.js:1
y @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
r @ 4d694e5.js:2
l @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
(anonymous) @ 4d694e5.js:2
register @ b7d4a19.js:1
submit @ b7d4a19.js:1
on @ 4d694e5.js:2
n @ 4d694e5.js:2
Io.c._wrapper @ 4d694e5.js:2

Update: I tried:

docker run -d --name baserow -e BASEROW_PUBLIC_URL=http://192.168.12.44 -v baserow_data:/baserow/data -p 80:80 --restart unless-stopped baserow/baserow:1.20.2

and it worked this time. I was able to get past the signup screen. I’ll keep you up to date as I try https later as well as an actual domain with ports forwarded.

In my case, the issue was resolved by changing the protocol from HTTP to HTTPS in the ‘BASEROW_PUBLIC_URL’ URL from http://my-domain.com to https://my-domain.com.

Thanks for sharing your experience, Diego! :raised_hands: