Having Time out error loading forms

We are facing gateway time out error while previewing form.

https://odk.staging.eastafricacoffee.org/-/preview/C8XLaj9aFCg35ae63GI0ydvcyiheTt9

This is the env

DOMAIN=https://odk.staging.eastafricacoffee.org/#/
SSL_TYPE=selfsign

In odk collect app too the form is not coming up , we suspect there is some issue with enketo.

This runs latest odk central 2023 v2.

Form XML

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:orx="http://openrosa.org/xforms" xmlns:odk="http://www.opendatakit.org/xforms">

    <h:head>

        <h:title>GPS location</h:title>

        <model>

            <instance>

                <data id="GPS-location" version="1666073709">

                    <meta>

                        <instanceID/>

                    </meta>

                    <location_default/>

                    <locationshowmap/>

                    <video/>

                </data>

            </instance>

            <itext>

                <translation lang="English">

                    <text id="/data/location_default:label">

                        <value>location1</value>

                    </text>

                    <text id="/data/locationshowmap:label">

                        <value>location2</value>

                    </text>

                    <text id="/data/video:label">

                        <value>video</value>

                    </text>

                </translation>

            </itext>

            <bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid"/>

            <bind nodeset="/data/location_default" type="geopoint" required="true()"/>

            <bind nodeset="/data/locationshowmap" type="geopoint" required="true()"/>

            <bind nodeset="/data/video" type="binary" required="true()"/>

        </model>

    </h:head>

    <h:body>

        <input ref="/data/location_default">

            <label ref="jr:itext('/data/location_default:label')"/>

        </input>

        <input ref="/data/locationshowmap" appearance="maps">

            <label ref="jr:itext('/data/locationshowmap:label')"/>

        </input>

        <upload ref="/data/video" mediatype="video/*">

            <label ref="jr:itext('/data/video:label')"/>

        </upload>

    </h:body>

</h:html>

We have looked at the docker logs. And the POST request times out with the following error message. Looks like this is something to do with routing the POSt request?

*2071 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.20.0.1, server: odk.staging.eastafricacoffee.org, request: "POST /-/transform/xform/JfzpocQZvwXhVw25H6Q6QzNjkxwyhl4 HTTP/1.1", upstream: "http://172.20.0.9:8005/-/transform/xform/JfzpocQZvwXhVw25H6Q6QzNjkxwyhl4", host: "odk.staging.eastafricacoffee.org", referrer: "https://odk.staging.eastafricacoffee.org/-/preview/JfzpocQZvwXhVw25H6Q6QzNjkxwyhl4"

As noted in .env.template...

  • The domain should be odk.staging.eastafricacoffee.org not https://odk.staging.eastafricacoffee.org/#/.
  • If you are using a self-signed cert, DOMAIN should be local.

Try fix that and rebuilding with docker compose build && docker compose up -d.

Thanks for the advise.
Now I get a 404
Does enketo have logs we can look it?
This problem happened after we upgraded to the latest with postgres 14

172.19.0.1 - - [28/May/2023:01:53:14 +0000] "POST /-/transform/xform/wV6p8TpSdyMAdQllxM7ZJVpvRJ7R80G HTTP/1.1" 404 343 "https://odk.staging.eastafricacoffee.org/-/preview/wV6p8TpSdyMAdQllxM7ZJVpvRJ7R80G"

I think form previews are keyed to the domain and you just changed yours. Try downloading the form definition, increasing the form version, re-uploading the form for publication.

We have tried building with the DOMAIN=local and selfsign
And we uploaded a fresh form to test.
Again the form failed to show. (screenshot attached)

Are there detailed logs that we can see?
Looks like some routing issues.
The issue started after we upgraded to the latest version with infrastructure upgrade to Postgres 14.

image

We managed to fix this error. It was something about not providing the appropriate ports.

In the new version there is a variable called $BASE_URL added and that was causing an error after upgrade.

We changed the config.json.template by changing
"env": {
"domain": "https://${DOMAIN}",
"sysadminAccount": "${SYSADMIN_EMAIL}"
}

Thanks for all the support.

1 Like