Unable to connect to formplayer service

Hi

I have installed commcare-hq as per the instructions in
https://github.com/dimagi/commcare-hq/blob/master/DEV_SETUP.md.

I am running the supporting services in docker. Django is running locally.

When I login to the application, I get following message:

OPTIONS http://localhost:8010/delete_application_dbs net::ERR_CONNECTION_REFUSED
send @ jquery.min.js:4
ajax @ jquery.min.js:4
(anonymous) @ app.js:530
triggerEvents @ backbone.js:369
triggerApi @ backbone.js:356
eventsApi @ backbone.js:155
Events.trigger @ backbone.js:346
receiver @ hq.events.js:47
postMessage (async)
_private.triggerPreviewEvent @ preview_app.js:95
(anonymous) @ preview_app.js:216
dispatch @ jquery.min.js:3
q.handle @ jquery.min.js:3
middleware.js:19 User navigated to selectApp

I tried running formplayer in docker. same error.
I also tried running formplayer.jar as
java -jar formplayer.jar --spring.config.name=formplayer
Still same error.

I can see the port (formplayer is configured to run on 8010) is listening at system side
tcp6 0 0 :::8010 :::* LISTEN

value of variable FORMPLAYER_INTERNAL_AUTH_KEY in localsettings.py and commcarehq.formplayerAuthKey in formplayer.properties are same.

Please give some information on what could cause this error.

Another observation is that I keep getting error in Developer window of the browser.

ws4redis.js:37 WebSocket connection to ‘ws://172.18.0.1:8000/ws/commcare-test:99eb2b3824788ae48ea49602ce004f4a:daec32b4fdb749799b31c1663aaaab77?subscribe-broadcast’ failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
connect @ ws4redis.js:37
(anonymous) @ ws4redis.js:56
ws4redis.js:100 Websocket connection is broken!

Thanks
Bindu

Hi Bindu, I see a few different hostnames in use in your screenshots - 10.20.10.80, localhost, and 172.18.0.1. Do those all look correct? Is the main django process accessible at localhost, or do you need to use 10.20.10.80? In particular, I’d double check the commcarehq.host variable in formplayer.properties.

When you run formplayer as a standalone jar, there should be some output displayed to the terminal. Do you see any issues with formplayer starting? When you navigate to the form builder and it attempts to make this request, does formplayer display any additional output suggesting it received the request?

1 Like

Do we have to set FORMPLAYER_URL as http://localhost:8010 or 172.18.0.1 or 10.20.10.80??

That depends on how your server is set up. You’ll need to set the port as well to whatever is configured as server.port in formplayer.properties. You should be able to try it out by running for example
$ curl localhost:8080
to find which one works. If it’s the correct URL, you should see a message like
{"error":"Invalid auth session"}
If it’s wrong, you’ll probably get a more general “Connection refused” error