Since a few days, whenever I log in to the admin interface, only one file is loaded in a collection and an error message shows up after a few seconds :
Failed to persist entry: API_ERROR: {"message":"404 File Not Found"}
I have tried many changes in the config.yml file but did not find a solution. Here is my config.yml :
backend:
name: git-gateway
branch: netlify # Branch to update (optional; defaults to master)
media_folder: "assets/images" # Media files will be stored in the repo under images/uploads
collections:
- name: "home-page" # Used in routes, e.g., /admin/collections/blog
label: "Page d'accueil" # Used in the UI
folder: "" # The path to the folder where the documents are stored
filter: {field: 'layout', value: 'home'}
create: false # Allow users to create new documents in this collection
slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "home"}
- {label: "Show", name: "show_tile", widget: "hidden", default: "false"}
- {label: "Titre", name: "title", widget: "string"}
- {label: "Sous-titre", name: "landing-title", widget: "string"}
- {label: "Description", name: "description", widget: "string"}
- {label: "Actualit茅s", name: "news", widget: "string"}
- {label: "Image principale", name: "image", widget: "image"}
- {label: "Body", name: "body", widget: "markdown"}
- name: "portfolio-pages" # Used in routes, e.g., /admin/collections/blog
label: "Pages des cr茅ations" # Used in the UI
folder: "" # The path to the folder where the documents are stored
filter: {field: 'layout', value: 'portfolio'}
create: true # Allow users to create new documents in this collection
# slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "portfolio"}
- {label: "Show", name: "show_tile", widget: "hidden", default: "true"}
- {label: "Titre", name: "title", widget: "string"}
- {label: "Sous-titre", name: "subtitle", widget: "string"}
- {label: "Description", name: "description", widget: "string"}
- {label: "Image principale", name: "image", widget: "image"}
- {label: "Image 1", name: "image1", widget: "image", required: false}
- {label: "Image 2", name: "image2", widget: "image", required: false}
Everything worked fine until a few days ago.
Did anybody experienced a similar bug ?
Thanks !
I don't know if that could help but here is the bug in the firefox dev console :
API_ERROR: "{"message":"404 File Not Found"}"
cms %5E2.0.0/dist/netlify-cms.js:14:136009
cms %5E2.0.0/dist/netlify-cms.js:14:136324
cms %5E2.0.0/dist/netlify-cms.js:45:25185
W/< entries.js:348:6
Either folder or file must have a value for each collection, you have an empty folder value for both collections.
Yep I've tried with "/" as folder value (that's where my .md files are) but I got the same issue
Have you tried putting your markdown files in a folder instead of in your sites root?
I have a somewhat similar issue. You can view my folder structure here: https://i.imgur.com/AGOJ3h5.png and the contents of my config.yml
#https://www.netlifycms.org/docs/add-to-your-site/
backend:
name: github
repo: https://github.com/jackieluc/insiight
branch: test # Branch to update (optional; defaults to master)
site_domain: https://test--insiight.netlify.com/#/
publish_mode: editorial_workflow
media_folder: "static/images/uploads" # Media files will be stored in the repo under static/images/uploads
public_folder: "/images/uploads" # The src attribute for uploaded media will begin with /images/uploads
collections:
- name: "blog" # Used in routes, e.g., /admin/collections/blog
label: "Blog" # Used in the UI
folder: "_posts/blog" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
- {label: "Title", name: "title", widget: "string"}
- {label: "Publish Date", name: "date", widget: "datetime"}
- {label: "Featured Image", name: "thumbnail", widget: "image"}
- {label: "Rating (scale of 1-5)", name: "rating", widget: "number"}
- {label: "Body", name: "body", widget: "markdown"}
and index.html are
<!-- https://www.netlifycms.org/docs/add-to-your-site/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Content Manager</title>
<link rel="stylesheet" href="https://unpkg.com/netlify-cms@^2.0.0/dist/cms.css" />
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</body>
</html>
I've tried going to http://localhost:8080/admin/#/ via npm start and it doesn't work there. It doesn't work at http://127.0.0.1:8080/admin/#/ when doing npm build preview either. I also tried branch deploys via the Netlify console but https://test--insiight.netlify.com/admin/# (which is our site) doesn't work either.
@q-omar add _posts/blog path to your repository
@q-omar add
_posts/blogpath to your repository
At the root? I tried that and getting the same error.
in your repository? or did you only add it local? I don't see it in your repository.
NetlifyCMS does not read from the local file system. It uses the backend configuration to get the files from your repository.
I added locally first but then I made the _posts/blog folder online via GitHub on the remote repository. Still running into same issue. Video here:
https://giant.gfycat.com/NimbleGrandHyena.mp4
I have also noticed that in my generated dist folder after running npm run preview, the config.yml file is not there: https://i.imgur.com/ANfG8mQ.png . is that supposed to be the case?
No, you must have the config.yml. Make sure it deploys also.
Why is it not appearing there? I believe I am doing everything else according to https://www.netlifycms.org/docs/add-to-your-site/
@q-omar, your issue does not seem to be the same as mine.
My admin folder with config.yml and index.html files is deployed. I can open the content manager interface, but the issue comes when loading the files that should be editable. I got the same issue if these files are located at the root of my repo or in a dedicated folder.
Furthermore, it used to work fine with the same config.yml file
The weird thing is that I can still access the files I want to edit by using the direct link (example https://www.myhost.com/admin/#/collections/home-page/entries/index). I can make any change I want and commit it without any issue.
The issue is just the cms not being able to load the editable files from the repo :
Failed to persist entry: API_ERROR: {"message":"404 File Not Found"}
@gcolson we need to be able to reproduce your issue to troubleshoot. Can you share the repo?
I've cloned my repo and made it public on github so you can see it : https://github.com/gcolson/lamaroquine/tree/netlify
A folder collection should be a dedicated folder that only contains files that Netlify CMS will edit, the CMS is choking because it's trying to load all of the various markdown files in your repo root. Instead use a file collection and provide the direct path to your home page. If your products pages such as divers and sacs should be treated as a folder collection, put them inside of a dedicated directory and update the folder in the config accordingly.
thanks a lot @erquhart, it works juste fine like that.
I still think there is an issue as it worked well with that config before. Maybe the last update changed that.
Furthermore, the doc is not really clear about where to store the files : it's written to store it in "/" for jekyll generator. That's what lead me to store it at the root and use filters to access only the files I want.
Feel free to close the issue if you don't think this is a bug !
The root is where you store your admin folder. It's common practice for almost all static site gens to have folders for your data and posts though, but it's good to know root doesn't work 馃憤
Most helpful comment
The root is where you store your
adminfolder. It's common practice for almost all static site gens to have folders for your data and posts though, but it's good to know root doesn't work 馃憤