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

CLI Export outputting bad JSON #2761

Open
augur-absorb opened this issue Sep 25, 2024 · 5 comments
Open

CLI Export outputting bad JSON #2761

augur-absorb opened this issue Sep 25, 2024 · 5 comments

Comments

@augur-absorb
Copy link

Expected Behavior

contentful space export --config migration-configs/export-contentModel-layout.json

Will export a clean JSON representing the Model (layout) I want to export using the following config:

{
    "spaceId": "",
    "environmentId": "master",
    "managementToken": "",
    "queryEntries": "sys.id=layout",
    "skipContentModel": "false",
    "skipContent": "true",
    "skipRoles": "true",
    "skipTags": "true",
    "skipWebhooks": "true"
}

Actual Behavior

The output is a mess, here is a snippet

{
  "contentTypes": ,
  [
    {
      "sys": {
        "space": {
          "sys": {
            "type": "Link""linkType": ,
            "Space""id": ,
            "92yop6rduul9"
          }
        } "id": ,
        "snippets""type": ,
        "ContentType""createdAt": ,
        "2023-02-03T16:31:58.365Z""updatedAt": ,
        "2023-03-16T22:13:19.937Z""environment": ,
        {
          "sys": {
            "id": "master""type": ,
            "Link""linkType": ,
            "Environment"
          }
        } "publishedVersion": ,
        9 "publishedAt": ,
        "2023-03-16T22:13:19.937Z""firstPublishedAt": ,
        "2023-02-03T16:32:00.085Z""createdBy": ,
        {
          "sys": {
            "type": "Link""linkType": ,
            "User""id": ,
            "5v7vAL4VgrlYaYWFzopg4e"
          }
        } "updatedBy": ,
        {
          "sys": {
            "type": "Link""linkType": ,
            "User""id": ,
            "5ycc1mTy0xRipRZEDU9BUy"
          }
        } "publishedCounter": ,
        5 "version": ,
        10 "publishedBy": ,
        {
          "sys": {
            "type": "Link""linkType": ,
            "User""id": ,
            "5ycc1mTy0xRipRZEDU9BUy"
          }
        } "urn": ,
        "crn:contentful:::content:spaces/92yop6rduul9/environments/master/content_types/snippets"
      } "displayField": ,
      "name""name": ,
      "Snippets""description": ,
      "Snippets are reusable blocks of content that can be added to Pages or Layouts.""fields": ,
      [
        {
          "id": "name""name": ,
          "Name""type": ,
          "Symbol""localized": ,
          false "required": ,
          false "validations": ,
          [] "disabled": ,
          false "omitted": ,
          false
        },
        {
          "id": "content""name": ,
          "Content""type": ,
          "RichText""localized": ,
          false "required": ,
          false "validations": ,
          [
            {
              "enabledNodeTypes": [
                "heading-1""heading-2",
                "heading-3",
                "heading-4",
                "heading-5",
                "heading-6",
                "ordered-list",
                "unordered-list",
                "hr",
                "blockquote",
                "embedded-entry-block",
                "embedded-asset-block",
                "table",
                "hyperlink",
                "entry-hyperlink",
                "asset-hyperlink",
                "embedded-entry-inline"
              ]
            },
            {
              "enabledMarks": [
                "bold""italic",
                "underline",
                "code"
              ]
            }
          ],
          ,
          "disabled": false "omitted": ,
          false
        }
      ]
    },

I am expecting to run the command, as I have many times in the past, and to produce a well-structured JSON.

Possible Solution

Steps to Reproduce

  1. Install Contentful CLI
  2. Setup Export Config
  3. Run command contentful space export --config migration-configs/export-contentModel-layout.json
  4. Check output.

Context

Environment

  • Language Version: tried: v18.17.0, v20.16.0, v21.7.3, v22.9.0
  • Package Manager Version: v9.6.7, v10.8.1,v10.5.0,v10.8.3
  • Browser Version: NA
  • Operating System: MAC OS 14.6.1 (Darwin ABSMAC-D049DRXXH3.localdomain 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020 arm64)
  • Package Version: 3.3.11
@tptech
Copy link

tptech commented Sep 26, 2024

Have experienced exactly the same thing. There appears to be extraneous commas all throughout the *-export.json file.

@camimora
Copy link

Hello! Same issue here on Mac Sonoma. I tried with several previous versions of the CLI but same result.

@nickamckenna
Copy link

I also have this problem (this is the first few lines of a 20,000,000 line export):

{
  "contentTypes":,
   [
    {"sys":
       {"space":
         {"sys":
           {"type":
            "Link" "linkType":,
            "Space" "id":,
            "xxxxxxxxxx"
          }
        } "id":,
        "resource" "type":,
        "ContentType" "createdAt":,
        "2021-11-09T18:00:11.040Z" "updatedAt":,
        "2022-11-14T15:33:06.034Z" "environment":,
         {"sys":
           {"id":
            "master" "type":,
            "Link" "linkType":,
            "Environment"
          }
        } "publishedVersion":,
        31 "publishedAt":,

There are properties with no values and it looks like some values are being outputted in the wrong place.

This means that we can't back up Contentful at the moment. And we can't create a new web site based on a previous web site.

Running on Windows 11 with the latest version of the CLI.

@nickamckenna
Copy link

Duplicate of #2760

@chris-cazaly-coop
Copy link

A recent contentful-cli release of v3.3.12 fixed this issue for us

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

No branches or pull requests

5 participants