Describe the Bug
I’m trying to import some test users into my local development environment by following the steps in the documentation. When I run cht-conf
, it reports it created 14 documents, but then shows an error.
How To Reproduce The Issue
- Create a CSV file called
users.csv
put it incsv
folder. see below for raw CSV. - Run the
cht-conf
command:cht csv-to-docs upload-docs create-users --url=https://medic:password@192-168-68-26.my.local-ip.co:8443
- See error:
ERROR StatusCodeError: 400 - {"code":400,"error":"Wrong type, object is not a place."}
Expected Behavior
I should see 2 new user in the admin area, two new contacts and two new places. I see none of these. I do see a number of docs in fauxton (14 I’m guessing!)
Logs
cht csv-to-docs upload-docs create-users --url=https://medic:password@192-168-68-26.my.local-ip.co:8443
WARN No project package.json file found at /home/mrjones/Documents/MedicMobile/csv-to-docs/package.json
WARN Project has no dependency on cht-conf.
INFO Checking that https://medic:****@192-168-68-26.my.local-ip.co:8443/medic/ is available...
INFO Processing config in csv-to-docs.
INFO Actions:
- csv-to-docs
- upload-docs
- create-users
INFO Starting action: csv-to-docs…
INFO Processing CSV file: /home/mrjones/Documents/MedicMobile/csv-to-docs/csv/users.csv …
INFO Users csv has been saved
INFO csv-to-docs complete.
INFO Starting action: upload-docs…
WARN This operation will permanently write 14 docs. Are you sure you want to continue?
Are you sure? [y/n]: y
14/14 docs
INFO Summary: 14 of 14 docs uploaded OK. Full report written to: upload-docs.1641510399181.log.json
INFO upload-docs complete.
INFO Starting action: create-users…
INFO Creating user alice
ERROR StatusCodeError: 400 - {"code":400,"error":"Wrong type, object is not a place."}
at new StatusCodeError (/usr/lib/node_modules/cht-conf/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/usr/lib/node_modules/cht-conf/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/usr/lib/node_modules/cht-conf/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/usr/lib/node_modules/cht-conf/node_modules/request/request.js:185:22)
at Request.emit (events.js:400:28)
at Request.<anonymous> (/usr/lib/node_modules/cht-conf/node_modules/request/request.js:1154:10)
at Request.emit (events.js:400:28)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/cht-conf/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
Input CSV file:
username password roles name phone contact.name place.c_prop place.type place.name place.parent
alice Secret_1 chw Alice Example 123456789 Alice p_val_a health_center alice area
bob Secret_1 chw bob Example 123456789 bob p_val_a health_center bob area
Error JSON file mentioned above:
cat upload-docs.1641510399181.log.json
{
"ok": [
"043d963b-75fd-550c-a4b9-30adfa43917a",
"0fc83157-873e-5d64-b064-a659d05f49fe",
"1d042305-6aab-5b6b-be09-8eee96b4b510",
"2403682f-8db3-5a15-ae78-0fcc4c20f5a4",
"577b8637-49c0-5925-a58a-372710e83d09",
"8a0a1987-dece-517c-bafa-43acb419cf20",
"9f3ec000-6c9c-5369-a532-9a286b79173f",
"a2e88124-37af-5886-8e7d-dd3d299f2cea",
"a54f8772-0361-5717-92e9-67081eba082c",
"b0700cc0-57f0-5847-91b9-31562f82c2ce",
"b14ffab5-cf81-5bcb-acfe-6ac6b7e21e4b",
"b20b4f67-25dc-51e8-a39b-43a6cd0ce7b5",
"b870f528-617f-5075-9aa0-486da6611f45",
"d74cb88b-0041-5b2f-a379-d029862b078d"
],
"failed": {}
}
Environment
- Instance: local dev
- Browser: NA
- Client platform: Ubuntu 20.04
- App: cht-conf
- Version: CHT Docker Helper with CHT 3.13 and
cht-conf
3.9.4.
Additional Context
I noticed that pretty much no matter what CSV I use I get this error (like delete the place.type
field for example). Also re-running the exact same command it reports “0 of 14 docs created” but then still shows the same error.