contentful / contentful-cli

The official Contentful command line interface. Use Contentful features straight from the command line!
https://www.contentful.com/developers/docs/tutorials/cli/
MIT License
324 stars 61 forks source link

Embargoed PDF (4MB) asset cannot be imported to new contentful environment #2073

Open brad-telus opened 1 year ago

brad-telus commented 1 year ago

Hi everyone, my team is running into issues trying to import embargoed assets to another environment. It seems that contentful-cli cannot process any asset that is embargoed. The script will simply timeout while waiting for the asset import to finish.

Expected Behavior

A PDF asset file of moderate size (4MB) that is embargoed can be exported from one contentful environment to another environment by running these commands:

# export content
echo 'Exporting contentful environment'
contentful space export --space-id $space_id --environment-id $source --include-drafts true --content-file entries.json
echo 'Export complete'

# import content from source env to target env
echo "Importing contentful content to target environment [${target}]"
contentful space import --timeout 3600000 --space-id $space_id --environment-id $target --content-file entries.json --error-log-file error.json
echo 'Import complete'

Actual Behavior

The embargoed PDF asset cannot be imported to the target environment. Even with the --timeout flag set to an hour, the script will hang on the asset import until the timeout is reached:

"stacktrace": [
        "AssetProcessingTimeout: Asset is taking longer then expected to process.",
        "/usr/local/share/.config/yarn/global/node_modules/contentful-management/dist/contentful-management.node.js:11070:21",
        "process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
      ]

Possible Solution

the contentful CLI should sign any embargoed assets before exporting/importing.

Context

I am trying to export the assets from one contentful environment (e.g. a staging environment) to another (e.g. a production environment)

Environment

nodejs: v18.12.0 contentful-cli: v2.6.9

hochoy commented 1 year ago

Implementation for this will likely follow similar approach as the instructions in this link. https://www.contentful.com/developers/docs/tutorials/general/embargoed-assets-getting-started/#rewriting-a-single-asset-url Screen Shot 2023-05-19 at 3 45 17 PM

Or perhaps there's a bug.

t849867 commented 1 year ago

This is for accessing embargoed assets from the CMA / CDA / CPA - this works fine for us for embargoed assets.

The issue we have is when migrating the content to a new environment using the CLI export and import command - the asset gets stuck on processing and even with --timeout set extremely high, the asset (~4MB) never migrates.