Cockpit: System error on save for collection link inside a set

Created on 1 Feb 2019  路  11Comments  路  Source: agentejo/cockpit

Hello,

when I try to save a repeater field with the following settings:

{
  "fields": [
    {
      "type": "set",
      "label": "Important Person",
      "options": {
        "fields": [
          {
            "type": "collectionlink",
            "label": "Name",
            "options": {
              "link": "people",
              "display": "name",
              "multiple": false,
              "limit": false
            }
          },
          {
            "name": "role",
            "label": "Role",
            "type": "text"
          }
        ]
      }
    }
  ]
}

I'm getting a system error.

Ideally, I would like to be able on that field to select the person and from the person database to receive the name and surname which would populate the full name automatically in the form, next I would like to set the role of that person.

Thanks!

All 11 comments

@panosru Do you have _people_ collection created? ("link": "people")

@Blistok of-course.... why would I post the issue without the collection? 馃槼

image

image

This seems to break (unhandled) when trying to link to nonexistent collection.
FWIW, I can't replicate on my end (latest next + config object you've posted). What's the system error?

@Blistok it just says system error

image

Could you point me in the right direction how to enable debug mode on cockpit so I could get the root of the issue?

Try enabling it in your config file:
'debug' => true

@Blistok Thanks! It wasn't documented :)

I got this:
image

And that is what I was posting:
image

This seems to be connected with mongo-php-driver, but I have no idea whether the error is on that side, or higher level in MongoDB PHP Library.

In any case the issue is caused by trying to write empty key to db here:
screen shot 2019-02-01 at 1 36 57 pm

Sorry I can't help more.

@Blistok Thanks mate! You helped enough!

I noticed the empty key, I'll have to debug it and find out why it is empty...

@panosru I think the _name_ property is required (its value seems to be used as a key), so if it's not provided it's just gonna infer the empty string.
Try adding it wherever you have only _label_ (e.g. "label": "Important Person", "label": "Name") [it only needs to be unique if it's on the same level], and see if that fixes your issue.

@Blistok Don't you ever dare to say again "Sorry I can't help more"!

image

You're a genius!

Thanks mate!

Just hit this problem with GraphiQL which returns INTERNAL SERVER ERROR if a repeater with set returns an empty string.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

crealx picture crealx  路  6Comments

victormoretti picture victormoretti  路  5Comments

poldixd picture poldixd  路  4Comments

jesperlandberg picture jesperlandberg  路  5Comments

TechnicallyJoe picture TechnicallyJoe  路  4Comments