decap-cms: Unable to access a collection: Unexpected end of JSON input

Hello, we are currently maintaining a site using Gatsby.js and Netlify CMS. Last week the CMS started failing to load a collection(file collection) of pages returning the error: Unexpected end of JSON input. We are getting the error on mediaLibrary.js and entrie.js resulting in the CMs not loading that collection. This issue only happens when we run the project locally, on production the CMS is working as expected.

Describe the bug

  1. we have a site with a collection named pages
  2. we have a site with over 1000 images
  3. we are using bitbucket as the backend
  4. mediaLibrary.js and entries.js fails with the Unexpected end of JSON input error, hence those collections are inaccessible

Applicable Versions:

  • Netlify CMS version: 2.14.3
  • Git provider: Bitbucket
  • OS: Mac OS Catalina
  • Node.JS version: 12+

CMS configuration

init({
    config: {
        slug: {
            clean_accents: true,
        },
        backend: {
            name: 'bitbucket',
            repo: [our-repo-name],
            branch,
            cmsLabelPrefix: branch,
            auth_type: 'implicit',
            app_id: process.env.NETLIFY_APP_ID,
        },
        media_folder: 'static/uploads',
        public_folder: '/uploads',
        publish_mode: 'editorial_workflow',
        local_backend: env === 'local',
        collections: CMS_COLLECTIONS,
    },
});

I appreciate it if you guys could help us figure out this error, we have been trying to debug it ourselves but we haven’t found what is causing those errors to throw. If you need more information I’ll happily add it.

Regards

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 17 (13 by maintainers)

Most upvoted comments

Hello guys, we will work on creating a repo with the error so you guys can run it. Thanks!

For the local proxy backend we might be able to drop the base64 encoding/decoding. Not sure for other backends if they support reading raw bytes.

As a general approach maybe something like https://github.com/discoveryjs/json-ext? That would require some more research

Yes, more information is definitely needed. There was this section in the issue template, that you skipped

**To Reproduce**
<!--
Steps to reproduce the behavior. For example:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
-->

please provide runnable example where this issue can be reliably reproduced.