Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to save: API_ERROR: Invalid tree info #3123

Closed
zslabs opened this issue Jan 21, 2020 · 8 comments
Closed

Failure to save: API_ERROR: Invalid tree info #3123

zslabs opened this issue Jan 21, 2020 · 8 comments

Comments

@zslabs
Copy link
Contributor

zslabs commented Jan 21, 2020

Describe the bug
Occasionally, our contributors are seeing the following when going back to revise a post that is not published yet, API_ERROR: Invalid tree info. I'm not sure if it's exclusive to non-published posts, but since I didn't see this error specifically in the issues so far, it seemed like a good idea to capture this one for others to help debug if they face it in the future.

To Reproduce

Applicable Versions:

  • netlify-cms-app 2.11.4
  • CMS_MANUAL_INIT flag set, skipping automatic initialization.'
  • netlify-cms-core 2.15.2
  • Git provider: gitHub
  • OS: Mac OS 10.15.2
  • Browser version Chrome (latest)
  • Node.JS version: 12.14.1

CMS configuration

import CMS from 'netlify-cms-app';
import cloudinary from 'netlify-cms-media-library-cloudinary';

CMS.registerMediaLibrary(cloudinary);

CMS.init({
  config: {
    load_config_file: false,
    backend: {
      name: 'github',
      repo: 'company/repo',
      branch: 'master',
    },
    publish_mode: 'editorial_workflow',
    media_library: {
      name: 'cloudinary',
      config: {
        ...
      },
    },
    media_folder: '/static/uploads',
    public_folder: '/uploads',
    collections: [
      ...
    ],
  },
});

@erezrokah erezrokah self-assigned this Jan 22, 2020
@erezrokah
Copy link
Contributor

Hi @zslabs and thank you for opening this. Can you share at least one collection setup this is happening for so we can try and create a reproduction? Also it would be very helpful if you can add the network traffic (from the browser dev tools) when the error occurs.

@zslabs
Copy link
Contributor Author

zslabs commented Jan 22, 2020

@erezrokah Sure thing! Of course attempting to replicate is extremely random, but I'll definitely let those that have been affected know about opening up their Network tab to help debug as well if it happens again.

export const posts = {
  label: 'Posts',
  name: 'posts',
  folder: 'src/posts',
  create: true,
  preview_path: 'blog/{{slug}}',
  fields: [
    {
      label: 'SEO Title',
      name: 'title',
      widget: 'string',
    },
    {
      label: 'SEO Description',
      name: 'description',
      widget: 'string',
    },
    {
      label: 'Slug Override',
      name: 'slug',
      widget: 'string',
      hint: "Will override default slug generated from 'SEO Title'.",
      pattern: [
        '^[a-z][-a-z0-9]*$',
        'Only lowercase alpha-numeric and hyphen characters allowed.',
      ],
      required: false,
    },
    {
      label: 'Date',
      name: 'date',
      widget: 'date',
      format: 'YYYY-MM-DD',
    },
    {
      label: 'Author',
      name: 'author',
      widget: 'relation',
      collection: 'authors',
      searchFields: ['title'],
      valueField: 'title',
      displayFields: ['title'],
    },
    {
      label: 'Categories',
      name: 'categories',
      widget: 'select',
      multiple: true,
      options: [
        ...
      ],
    },
    {
      label: 'Featured Image',
      name: 'featuredImage',
      widget: 'image',
    },
    {
      label: 'Social Media Image',
      name: 'socialMediaImage',
      widget: 'image',
    },
    {
      label: 'Body',
      name: 'body',
      widget: 'markdown',
    },
    {
      label: 'Article CTA',
      name: 'articleCTA',
      hint: 'Override default CTA for blog posts',
      widget: 'relation',
      collection: 'articleCTA',
      searchFields: ['title'],
      valueField: 'title',
      displayFields: ['title'],
      required: false,
    },
  ],
};

@erezrokah
Copy link
Contributor

I've set up this branch https://github.com/erezrokah/netlify-cms-reproductions/commits/netlify_cms/issue_3123 in an attempt to reproduce.

One thing to consider is that when saving an editorial workflow entry the CMS will try to rebase the editorial workflow entry branch with the default branch. That operation might fail.
When/If that happens for a specific entry, it would be useful to look at the status of the PR in GitHub to verify there are no conflicts.

@zslabs
Copy link
Contributor Author

zslabs commented Jan 23, 2020

@erezrokah Thanks for setting that up! That is an interesting tidbit that I forgot to mention. While my changes were done in a different file/location, I did push to the repo between saves in the CMS. I'm not quite sure if this has happened during a "fresh" creation/save, but I can at least verify when it has happened there have not been any conflicts in GitHub.

@erezrokah
Copy link
Contributor

erezrokah commented Jan 23, 2020

Thanks @zslabs that helps. Another thing to try is cloning the repo locally, switching to the CMS branch with the relevant entry an attempting a rebase.

@cyrill62
Copy link

cyrill62 commented Feb 13, 2020

It seems to be related to the relation widget.

I have some content without this widget, and do not have this problem.

But with content with this widget and an entity in this relation field, the content won't save and fallback to "unsaved" state.

@erezrokah
Copy link
Contributor

@cyrill62 thank you for the info, there is an standing issue with relation widget showing unsaved changes #725

@erezrokah
Copy link
Contributor

Closing this as stale as many changes were done to the backends to improve error handling.
If is still an issue please comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants