decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

🐛 502 error when editing collection

Open bradystroud opened this issue 2 years ago • 5 comments

Describe the bug 502 Error when trying to edit a collection. This is only effecting some users

8f5fd0ff-6fcf-4cc4-b704-893bce14b08e

Applicable Versions:

  • Decap CMS version: "netlify-cms-app": "^2.15.72"
  • Git provider: GitHub
  • OS: Windows
  • Browser version: Chrome

CMS configuration

https://github.com/SSWConsulting/SSW.Rules/blob/main/src/cms/config.js
import { generateGuid } from '../helpers/generateGuid';

var configJson = {
  config: {
    backend: {
      name: 'github',
      repo: 'SSWConsulting/SSW.Rules.Content',
      branch: process.env.CONTENT_BRANCH,
      open_authoring: true,
      auth_endpoint: '/api/auth',
      always_fork: true,
      base_url: process.env.API_BASE_URL,
      use_graphql: true,
    },
    site_url: 'https://www.ssw.com.au/rules',
    publish_mode: 'editorial_workflow',
    logo_url:
      'https://www.ssw.com.au/ssw/logo/SSWRules/Downloads/SSW%20Rules.png',
    show_preview_links: false,
    search: false,
    media_folder: 'static/assets',
    public_folder: '/assets',
    collections: [
      {
        name: 'rule',
        label: 'Rule',
        sortable_fields: [],
        folder: 'rules',
        media_folder: '',
        public_folder: '',
        slug: 'rule',
        path: '{{uri}}/rule',
        create: true,
        fields: [
          {
            name: 'type',
            label: 'Type(e.g.rule / category)',
            widget: 'hidden',
            default: 'rule',
          },
          { name: 'title', label: 'Title' },
          {
            name: 'uri',
            label: 'uri (a unique identifier for the url)',
            pattern: [
              '^[a-z0-9_-]*$',
              'Must only contain lowercase alphanumeric or the "-" and "_" characters',
            ],
          },
          {
            name: 'body',
            label: 'Body',
            widget: 'markdown',
            default: `Instructions for creating rules can be found at [How to Create Rules](https://github.com/SSWConsulting/SSW.Rules.Content/wiki/How-to-Create-Rules). Follow the steps below and replace the text in this box with your own content.
            
1. Place your intro here. This will show in the blurb.
            
<!--endintro-->

2. Place your content here. Markdown is your friend. See this [example rule](https://www.ssw.com.au/rules/rule) for all the things you can do with Rules.
3. Submit your rule for review.
4. Add your rule to a category. See [How to Add and Edit Categories and Top Categories](https://github.com/SSWConsulting/SSW.Rules.Content/wiki/How-to-Add-and-Edit-Categories-and-Top-Categories).`,
          },
          {
            name: 'authors',
            label: 'Acknowledgements',
            widget: 'list',
            fields: [
              { name: 'title', label: 'Name' },
              { name: 'url', label: 'Profile url', required: false },
              { name: 'img', label: 'Profile image', required: false },
            ],
            default: [{ title: '' }],
          },
          {
            name: 'related',
            label: 'Related',
            required: false,
            widget: 'list',
            field: {
              name: 'relatedRule',
              label: 'Rule uri',
              hint: 'The URI for the related rule, i.e. label-your-assets',
              pattern: [
                '^[a-z0-9_-]*$',
                'Must only contain lowercase alphanumeric or the "-" and "_" characters',
              ],
            },
          },
          {
            name: 'redirects',
            label: 'Redirects',
            required: false,
            widget: 'list',
            field: {
              name: 'redirectUri',
              label: 'Redirect uri',
              hint: 'The URI for the old rule, i.e. label-your-assets',
            },
          },
          {
            name: 'created',
            label: 'Date created',
            widget: 'datetime',
            field: {
              name: 'relatedRule',
              label: 'Rule',
              widget: 'relation',
              collection: 'rules',
              search_fields: ['title'],
              value_field: 'uri',
              display_fields: ['title'],
              options_length: 5,
            },
          },
          {
            name: 'archivedreason',
            label:
              'Archive this rule by adding a reason (leave blank to unarchive)',
            required: false,
          },
          {
            name: 'guid',
            label: 'GUID',
            widget: 'hidden',
            pattern: [
              '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$',
              'Must be a valid GUID',
            ],
            default: generateGuid(),
          },
        ],
      },
    ],
  },
};

export default configJson;

bradystroud avatar Sep 26 '23 00:09 bradystroud

@bradystroud what happens if you upgrade the CMS to decap 3?

martinjagodic avatar Sep 26 '23 06:09 martinjagodic

We have a Gatsby site, and use the gatsby-plugin-netlify-cms package Looks like it hasn't been updated to decap yet, see issue https://github.com/gatsbyjs/gatsby/issues/38553

There is a PR open, so hopefully it gets updated soon 🙂 https://github.com/gatsbyjs/gatsby/pull/38554

bradystroud avatar Sep 27 '23 01:09 bradystroud

If those users clear the cache and log in again, does the error still happen?

martinjagodic avatar Sep 27 '23 07:09 martinjagodic

@bradystroud how many entries do you have? Is it possible that you are hitting the GitHub rate limit? How does the failed response look in your network tab?

martinjagodic avatar Oct 20 '23 08:10 martinjagodic

Update - we have upgraded from Netlify to Decap CMS but the issue is still there

If those users clear the cache and log in again, does the error still happen?

Yes - the issue persists

how many entries do you have?

@martinjagodic more than 3,200 entries

Is it possible that you are hitting the GitHub rate limit?

Yes - But I would expect an error that says you are hitting the GitHub rate limit if that was the case

How does the failed response look in your network tab?

This error is in the response

Something went wrong while executing your query. This may be the result of a timeout, or it could be a GitHub bug. Please include 058C:63C7C:D2B60A:E85067:6593434F when reporting this issue.

bradystroud avatar Jan 01 '24 23:01 bradystroud