Rocket.chat: [BUG] Getting "error-invalid-customfield-json" on signup with Custom Fields

Created on 10 Oct 2017  路  11Comments  路  Source: RocketChat/Rocket.Chat

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;
bug

Most helpful comment

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
    }
}

All 11 comments

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

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

@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.

@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 :)

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

@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: https://github.com/RocketChat/Rocket.Chat/pull/7688

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.

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

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
    }
}

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)

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brendanheywood picture brendanheywood  路  3Comments

zeigerpuppy picture zeigerpuppy  路  3Comments

royalaid picture royalaid  路  3Comments

tanc picture tanc  路  3Comments

antn89 picture antn89  路  3Comments