You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GET /formList from Docker image fails with error from openros #116
Error: not well-formed (invalid token)
at /app/api/odk/controllers/get-formlist.js:38:23
at buildXml (/app/node_modules/openrosa-formlist/index.js:77:21)
at /app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:251:17
at done (/app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:126:15)
at /app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:32:16
at Parser.<anonymous> (/app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:248:21)
at emitOne (events.js:101:20)
at Parser.emit (events.js:188:7)
at Parser.write (/app/node_modules/node-expat/lib/node-expat.js:68:10)
at Stream.ondata (internal/streams/legacy.js:16:26)
Is this a version mismatch perhaps with openrosa?
Or, more generally, might you all have any advice on how to proceed? (And sorry to post on issues; couldn't find a mailing list / slack channel / IRC)
It looks like a port problem; I get this error instead (do you have other services running?):
Error: connect ECONNREFUSED 127.0.0.1:8080
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)
The way /formList is implemented, it makes an HTTP request to itself based on the URL provided in the request (this has caused problems in other contexts, but is generally convenient). This means that it's making a request to http://localhost:8080/... but OMK Server is listening on :3210 in that context.
You should be able to work around the problem by starting OMK with:
Thanks for the note! lsof -i tcp | grep LIST shows no other services running on this machine except SSH and local SMTP. I haven't seen the traceback you've got there, just the one above.
FWIW, I get the same traceback with-e PORT 8080:
~$ docker run --rm -e PORT=8080 -p 8080:8080 -v /tmp/data:/app/data --name omk omk
OpenMapKit Server is listening on port 8080.
cError: not well-formed (invalid token)
at /app/api/odk/controllers/get-formlist.js:38:23
at buildXml (/app/node_modules/openrosa-formlist/index.js:77:21)
at /app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:251:17
at done (/app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:126:15)
at /app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:32:16
at Parser.<anonymous> (/app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:248:21)
at emitOne (events.js:101:20)
at Parser.emit (events.js:188:7)
at Parser.write (/app/node_modules/node-expat/lib/node-expat.js:68:10)
at Stream.ondata (internal/streams/legacy.js:16:26)
and when using the default port:
$ docker run --rm -p 3210:3210 -v /tmp/data:/app/data --name omk omk
OpenMapKit Server is listening on port 3210.
Error: not well-formed (invalid token)
at /app/api/odk/controllers/get-formlist.js:38:23
at buildXml (/app/node_modules/openrosa-formlist/index.js:77:21)
at /app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:251:17
at done (/app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:126:15)
at /app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:32:16
at Parser.<anonymous> (/app/node_modules/openrosa-formlist/node_modules/async/lib/async.js:248:21)
at emitOne (events.js:101:20)
at Parser.emit (events.js:188:7)
at Parser.write (/app/node_modules/node-expat/lib/node-expat.js:68:10)
at Stream.ondata (internal/streams/legacy.js:16:26)
To reproduce this, I:
Start the container
Upload the buildings_example.xlsx file linked above.
Click to view the list of forms.
It also seems to reproduce if I:
Copy the data/ directory from the repo into the docker volume directory.
Start the container
Click to view the list of forms.
I'll try building from a VM next and let you know if it replicates there, too. Thanks again for the help!
and finally got the error you were talking about. But, this doesn't seem
like the issue, since with `Host: localhost:3210" we're back to a
working response:
So, this seems to have something to do not with connectivity back to the
server in the container, but with the hostname being different than
expected after the connection's been made. Just my guess, though.
Activity
sethfitz commentedon Jul 13, 2018
Nah, this is a great issue.
It looks like a port problem; I get this error instead (do you have other services running?):
The way
/formListis implemented, it makes an HTTP request to itself based on the URL provided in the request (this has caused problems in other contexts, but is generally convenient). This means that it's making a request tohttp://localhost:8080/...but OMK Server is listening on:3210in that context.You should be able to work around the problem by starting OMK with:
hblanks commentedon Jul 16, 2018
Thanks for the note!
lsof -i tcp | grep LISTshows no other services running on this machine except SSH and local SMTP. I haven't seen the traceback you've got there, just the one above.FWIW, I get the same traceback with
-e PORT 8080:and when using the default port:
To reproduce this, I:
buildings_example.xlsxfile linked above.It also seems to reproduce if I:
data/directory from the repo into the docker volume directory.I'll try building from a VM next and let you know if it replicates there, too. Thanks again for the help!
sethfitz commentedon Jul 16, 2018
Can you paste the output of this (when using the default port):
curl -H "Accept: application/json" http://localhost:3210/omk/data/forms/(These are the requests made internally to produce the form list.)
It should look like
Ditto for
and
hblanks commentedon Jul 18, 2018
For this reply, the command, run on host leaf, was:
GET /omk/data/formsworks locally:And remotely, too:
So does
GET /omk/data/forms/:form_name:and
GET /omk/odk/manifest/:form_name:and indeed, locally, the formlist works!:
but, still locally, not with the machine's hostname:
I did verify that the endpoint is accessible by hostname within the
container:
Then, I thought, maybe this has something to do with the HTTP host
header? So I ran:
and finally got the error you were talking about. But, this doesn't seem
like the issue, since with `Host: localhost:3210" we're back to a
working response:
So, this seems to have something to do not with connectivity back to the
server in the container, but with the hostname being different than
expected after the connection's been made. Just my guess, though.
sethfitz commentedon Jul 20, 2018
Can you make the same requests for OMK forms + manifests using the
leafhostname?I've had moderate success in other contexts starting Docker w/ something similar to
--add-host leaf:127.0.0.1, which could help with resolution.