Closed kitella1 closed 4 years ago
I think I know the cause of this error and how to reproduce it.
Cause: You have a list widget, probably
- label: Technologies and Skills
name: techskills
widget: list
and you have a few entries in which the value of the widget is in string format.
For e.g. one of your prototype
flie might have something like
techskills: xyz
instead of
techskills: [xyz]
i.e. string instead of list, and when netlifycms tries joining it (e.join()
e which is supposed to be an array but turns out as a string), it gives out an error because your file had techskills
stored as a string.
Reproducing the error: create a collection with a string widget, create an entry with the string filled in, and update the config file by changing the string widget to list, now when the entry is tried to open again, this error occours.
Fix: check wether e is an array before doing e.join()
if(e.isArray()){
e.join(',')
}
I've been offline for a while so did not get any of the notifications for this. I believe that your comment @ar363 is correct. If memory serves, I did have to redo my config.yml file and the issue was regarding the list widgets. My YAML now looks like this and works without issue:
collections:
- name: "prototype"
label: "Prototype"
format: "json"
folder: "content/prototypes"
preview_path: "prototype/{{slug}}"
create: true
slug: "{{slug}}"
editor:
preview: false
fields:
- label: "Title"
name: "title"
widget: "string"
- label: "Hero Image"
name: "hero"
widget: "image"
allow_multiple: false
required: false
- label: "Year of Completion"
name: "date"
widget: "datetime"
date_format: "YYYY"
- label: "Technologies and Skills"
name: "techskills"
widget: "list"
field: { label: "List Item", name: item, widget: string }
- label: "High Concept"
name: "highconcept"
widget: "markdown"
- label: "Video"
name: "video"
widget: "file"
required: false
- label: "Flowchart"
name: "flowchart"
widget: "code"
required: false
hint: "In the editor of your choice, export your diagrams as an iFrame. Untick any options for borders, editing, and layers."
- label: "Description"
name: "description"
widget: "markdown"
- label: "Supporting Document"
name: "document"
widget: "file"
required: false
- label: "Gallery Images"
name: "gallery"
widget: "list"
required: false
fields:
- { label: "Image", name: "image", widget: "image" }
- {
label: "Image Description (For Screen Readers)",
name: "alt",
widget: "string",
}
- label: "External Links"
name: "links"
widget: "list"
required: false
fields:
- {
label: "Type",
name: "linktype",
widget: "select",
options: ["Game Files", "Other URL"],
}
- {
label: "Location Name: i.e. ArtStation, Steam",
name: "linkname",
widget: "string",
}
- { label: "Target", name: "linktarget", widget: "string" }
- name: "desdoc"
label: "Design Document"
format: "json"
folder: "content/design-documents"
preview_path: "design/{{slug}}"
create: true
slug: "{{slug}}"
editor:
preview: false
fields:
- label: "Title"
name: "title"
widget: "string"
- label: "Hero Image"
name: "hero"
widget: "image"
allow_multiple: false
required: false
- label: "Year of Completion"
name: "date"
widget: "datetime"
date_format: "YYYY"
- label: "Technologies and Skills"
name: "techskills"
widget: "list"
field: { label: "List Item", name: item, widget: string }
- label: "Flowchart"
name: "flowchart"
widget: "code"
required: false
hint: "In the editor of your choice, export your diagrams as an iFrame. Untick any options for borders, editing, and layers."
- label: "High Concept"
name: "highconcept"
widget: "markdown"
- label: "Supporting Document"
name: "document"
widget: "file"
required: false
- label: "Description"
name: "description"
widget: "markdown"
- label: "External Links"
name: "links"
widget: "list"
required: false
fields:
- {
label: "Type",
name: "linktype",
widget: "select",
options: ["Game Files", "Other URL"],
}
- {
label: "Location Name: i.e. ArtStation, Steam",
name: "linkname",
widget: "string",
}
- { label: "Target", name: "linktarget", widget: "string" }
Hopefully this helps someone else even though my issue has now been resolved
Closing this as a duplicate of https://github.com/netlify/netlify-cms/issues/3524
Describe the bug Cannot open any collection entries on my CMS.
To Reproduce I just tried to open a collection entry and it crashed, saving that e.join is not a function.
Expected behavior I should be able to open the entry and start editing. When I click on the entry, I'm met with an error page.
Screenshots ]
Applicable Versions:
netlify-cms@2.10.63
git-gateway
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
CMS configuration