Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV "Add users" not working #418

Closed
1 of 2 tasks
crimsonclyde opened this issue Jul 6, 2021 · 5 comments
Closed
1 of 2 tasks

CSV "Add users" not working #418

crimsonclyde opened this issue Jul 6, 2021 · 5 comments

Comments

@crimsonclyde
Copy link

crimsonclyde commented Jul 6, 2021

Is this a BUG REPORT or FEATURE REQUEST?:

  • BUG
  • FEATURE

What happened:
CSV import not working.

This might be not a real bug, but if anyone has same issues maybe this could be a good place to find more info.
All in all thx to polonel the containers work great!

What did you expect to happen:
Use a csv file in format:
username,fullname,email,roleid,title while roleID is the one from mongo

To get the ID use (container: mongo_db)
mongo
show dbs
use trudesk
db.trudesk.find().pretty()

How to reproduce it (as minimally and precisely as possible):

  1. Create users.csv
  2. Add and save content to it:
    Jane,Jane Doe,[email protected],60xxxxx53857,MyCorp
    John,John Doe,[email protected],60xxxxxb53857,MyCorp
  3. Try to import via CSV import

Anything else we need to know?:
Browser console:
Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data allcomplete https://help.mycorp.me:88/js/7.js:18 complete https://help.mycorp.me:88/js/0.js:57 onreadystatechange https://help.mycorp.me:88/js/0.js:57 upload https://help.mycorp.me:88/js/0.js:57 xhrupload https://help.mycorp.me:88/js/0.js:57 init https://help.mycorp.me:88/js/0.js:57 dispatch https://help.mycorp.me:88/js/0.js:25 handle https://help.mycorp.me:88/js/0.js:25

Server log
TypeError: csv is not a function at accountsController.uploadCSV (/usr/src/trudesk/src/controllers/accounts.js:291:16) at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5) at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13) at middleware.redirectToLogin (/usr/src/trudesk/src/middleware/middleware.js:77:10) at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5) at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/usr/src/trudesk/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5) at /usr/src/trudesk/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/usr/src/trudesk/node_modules/express/lib/router/index.js:335:12) at next (/usr/src/trudesk/node_modules/express/lib/router/index.js:275:10)

Tried with reverse proxy (nginx) and without (only http) same thing.
Tried with role "user" and "User" because someone else mentioned it. No luck.

Image upload is working and everything else, it seems, as well. Only CSV import, not.

This was the only resource I found so far.
https://forum.trudesk.io/t/how-to-import-user-from-csv/131

Environment:

  • Trudesk Version: trudesk v1.1.6
  • OS (e.g. from /etc/os-release): NAME="Ubuntu", VERSION="20.04.2 LTS (Focal Fossa)
  • Node.JS Version: v12.22.1
  • MongoDB Version: db version v3.6.23
  • Is this hosted on cloud.trudesk.io: No
@polonel
Copy link
Owner

polonel commented Jul 11, 2021

This is indeed a bug. I'll work on getting it fixed.

@crimsonclyde
Copy link
Author

Let me know if you need additional information, I will be happy to support if I can!

@polonel
Copy link
Owner

polonel commented Jul 12, 2021

CSV Format

Username,Name,Email,RoleId,Title
test.user,Test User,[email protected],5c89591a681b48468c7e99a1,User Title

I will try to push a release with this included in the next couple of days. (if you need it before then you can see in the commit what was changed. Its only a couple of lines)

@polonel polonel closed this as completed Jul 12, 2021
@crimsonclyde
Copy link
Author

@polonel
Will test and report tomorrow :) thx for that quick response on that.

@crimsonclyde
Copy link
Author

crimsonclyde commented Jul 13, 2021

Tested works.

File changed, Container (Trudesk) restarted.

Just a hint for everyone else:
Don't use this example from above. Import works, but after that Trudesk crashes.
Use YOUR correct RoleID's ;)
You need to delete the entries in MongoDB manually.

mongo
use trudesk
db.accounts.deleteMany({role:ObjectId("5c89591a681b48468c7e99a1")})
db.accounts.find().pretty()

@polonel : Thx for your help!
Rly appriciated and awesome work. Keep up your good spirit! Cheers!

polonel added a commit that referenced this issue Jul 15, 2021
## [1.1.7](v1.1.6...v1.1.7) (2021-07-15)

### Bug Fixes

* **import:** importing users with csv [#418](#418) ([d2cab62](d2cab62))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants