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

[BUG] Getting "error-invalid-customfield-json" on signup with Custom Fields #8448

Closed
rafaelks opened this issue Oct 10, 2017 · 12 comments
Closed
Assignees

Comments

@rafaelks
Copy link
Contributor

Description:

We're working to add support to Custom Fields into the native iOS app and in my tests, I can't have Custom Fields and create a new user from the web.

Server Setup Information:

  • Version of Rocket.Chat Server: 0.58.2
  • Operating System: Linux
  • Deployment Method(snap/docker/tar/etc): hosting
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • Node Version: v4.8.4

Steps to Reproduce:

  1. Login with administrator user;
  2. Go to Administration -> Accounts -> Registration (tap Expand);
  3. Copy the example JSON for Custom Fields;
  4. Paste it on the Custom Fields text view;
  5. Save the changes;
  6. Logout from the user;
  7. On the login screen, try to create a new user;

screen shot 2017-10-10 at 8 47 44 am

Expected behavior:

  1. User should be prompt of custom fields on the registration field;
  2. OR user should be prompt of custom fields after registering the user;

Actual behavior:

  1. User can't create any new accounts into the server;
@rafaelks
Copy link
Contributor Author

Looks like the error happens because there's an invalid character. I did fix this issue in our docs (RocketChat/docs-old#410) but I don't know exactly how to fix in the Admin docs, since that JSON is being used as a translated string (?).

@maxpen
Copy link

maxpen commented Oct 10, 2017

I get this issue also on my default rocketchat instance in browser. Not just for IOS APP.

@rafaelks
Copy link
Contributor Author

@maxpen Looks like the JSON is invalid when this error happens. Make sure you use some JSON linter to validate it and remove any invalid character: http://jsonlint.com.

After that, everything should work just fine.

@maxpen
Copy link

maxpen commented Oct 10, 2017

@rafaelks Can you copy me a working example? I'm not so good with json and that tool just tells me SyntaxError: Bad string on line 1 and I have no idea what is wrong with line 1 :)

@MartinSchoeler
Copy link
Member

@maxpen The script on this pr file should be working https://github.com/RocketChat/Rocket.Chat.Docs/pull/410/files

@maxpen
Copy link

maxpen commented Oct 10, 2017

@MartinSchoeler that works! When do we see this pr in the new release?

Also how do I display these custom values for other users or get them to show up in the admin panel for each user?

This issue has not fixed it: #7688

@JSzaszvari
Copy link
Contributor

I'm unable to get any customfields to show up in the UserInfo tab as well. I can see it when i go into My Account just not when I look at a users profile.

@si90
Copy link

si90 commented Jan 31, 2018

The problem is really annoying, it would be great if you could change the behavior like described from
@rafaelks

@rafaelks
Copy link
Contributor Author

Tried again this today... took me many tries until I got it right. There's no kind of JSON validation on the field and copying it from the documentation doesn't work because of hidden characters.

In case anyone wants to try the documentation JSON, here's one working:

{
    "role": {
        "type": "select",
        "defaultValue": "student",
        "options": ["teacher", "student"],
        "required": true,
        "modifyRecordField": {
            "array": true,
            "field": "roles"
        }
    },
    "twitter": {
        "type": "text",
        "required": true,
        "minLength": 2,
        "maxLength": 10
    }
}

@vynmera
Copy link
Contributor

vynmera commented Jun 12, 2018

yeah, the documentation below it is useless to copy, it uses tabs which doesnt work
also in the i18n some people translated the field keys (i assume that wont work)

@ggazzo ggazzo self-assigned this Jun 13, 2018
@arminfelder
Copy link
Contributor

I experienced the same issue, I guess we should let RocketChat sanetize the JSON , by removing tabs

@ggazzo ggazzo closed this as completed May 20, 2020
@robincafolla
Copy link

robincafolla commented May 17, 2021

I don't believe this issue should have been closed? Certainly it's still present in v3.14.0

For clarification; tabs in the custom fields JSON will silently fail until a user tries to register.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants