Netlify-cms: Relation Widget Fails Without Intelligent Error Message

Created on 3 Feb 2018  路  5Comments  路  Source: netlify/netlify-cms

- Do you want to request a feature or report a bug?
bug

- What is the current behavior?
If you put an invalid value for searchFields it fails with a "sorry there was an error", but no details anywhere what the error was.

In my case I created a new collection that had a relation widget field. I mistakenly set the searchFields value to "[title]" instead of ["title"]. What really threw me off was that it allowed me to create new pages for the collection, but the message-less error page would show up when I tried to edit created pages.

- If the current behavior is a bug, please provide the steps to reproduce.

  1. Add a relation field and place a string in for searchFields.
  2. Create a new page for the collection.
  3. Try to edit the page.
  4. You should receive a very minimal error page that isn't helpful. Looking at the devtools JS console will also show no error messages that are easily understandable. I think there was some convoluted traceback about a toJS function not existing, but can't remember exactly. I tried tracing it at one point, but couldn't find an answer.

- What is the expected behavior?
The error page should have a message stating the searchFields value is of the wrong type or that there is no field named the given value in the given collection.

And Thank you for all the great work you guys put into this software!

- Please mention your CMS, node.js, and operating system version.

1.0, v8.1.3 local ( not sure what version netlify uses), and Ubuntu Linux (but I was testing it on netlify's system through the web)

- Please link or paste your config.yml below if applicable.
I don't think this would be helpful but here it is:

  - name: "sub_page"
    label: "Sub Pages"
    folder: "src/documents/sub_pages"
    create: "true"
    slug: "{{slug}}"
    fields:
      - {label: "Title", name: "title", widget: "string", tagname: "h1"}
      - {label: "Navigation Bar Text", name: "navTitle", widget: "string"}
      - {label: "Which Main Page to sort navigation button under.", name: "navNest", widget: "relation", collection: "main_page", searchFields: "[title]", valueField: "title"}
      - {label: "Navigation bar priority (lower=farther up)", name: "navPriority", widget: "number"}
      - {label: "Body", name: "body", widget: "markdown"}
      #hidden fields are not editable by the user but still show up in the file's front matter
      - {label: "Collection", name: "collection", widget: "hidden", default: "SubPage"}
      - {label: "Layout", name: "layout", widget: "hidden", default: "default.html"}
    meta:
      - {label: "Publish Date", name: "date", widget: "datetime", format: "YYYY-MM-DD hh:mm:ss"}
error-handling extensionwidgets claimed intermediate good first issue enhancement accepted stale

Most helpful comment

I would like to take a stab at this issue!

All 5 comments

Thanks for opening this, I'd love to see our error handling game improved. We implemented that error component to stop folks from working in a broken environment, unaware that the CMS stopped working long ago (this way we prevent data loss), but we haven't put it to work with useful error messages yet.

I would like to take a stab at this issue!

@solpark Great! If it helps you at all, the Error component is under /src/components/UI/ErrorBoundary/ErrorBoundary.js.

Hey @solpark - feel free to come holler at us in Gitter if you get stuck :)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings