Space clone: assets issue

Hi there.

I’ve cloned a space and there is an issue with assets.

This is the script:

let fileName = `export_mm7bfysjbulb_${moment().format('x')}.json`
//Export
spaceExport({
    spaceId: "mm7bfysjbulb",
    managementToken: accessToken,
    useVerboseRenderer: true,
    errorLogFile: 'error.json',
    saveFile: false,
    includeDrafts: true
}).then(output => {
    fs.writeFileSync(
      path.join(__dirname, '../exports', fileName),
      JSON.stringify(output)
    )
})
//Import
return spaceImport({
    spaceId: "niuyvdh3hcjp",
    managementToken: accessToken,
    contentFile: path.join(__dirname, '../exports', fileName),
    contentModelOnly: false,
    skipLocales: false,
    errorLogFile: 'error.json'
  })

All content types, entries, roles, etc etc are imported.

But when I open an asset in the web app, it’s still in “processing” state:

The asset entry has “strange” data:

"fields": {
    "title": {
      "it-IT": "1000x1000"
    },
    "file": {
      "it-IT": {
        "upload": "https://images.contentful.com/mm7bfysjbulb/3hFuQ51356wwkMouiqwKIc/bb3a43e176a27bc87a61f0652dc96648/1000x1000.jpg",
        "fileName": "1000x1000.jpg",
        "contentType": "image/jpeg"
      }
    }
  }

where mm7bfysjbulb is the source spaceId. The problem is only with draft assets.

The two spaces have the same default locale.

Hey @vmilone,

The problem is only with draft assets.

This does mean they’ve never been published by now, right?
From what I know, those assets are not available at the images.contentful.com endpoint, until they are published.

Have you tried setting the downloadAssets option to true?

Best,
Stephan

1 Like

Hi Stephan,

draft assets are already on Contentful CDN, so there isn’t any problem to reach them:

For example the 2SwkwbcFtegyygakCOkEAU asset is draft:
https://images.contentful.com/mm7bfysjbulb/2SwkwbcFtegyygakCOkEAU/73b23f3e55da1840e670c87873f6f73e/picture-1.jpg

hey @vmilone,
Khaled here the maintainer of the import and export tools.
The import tool tends to import data as is, so if an asset is draft in your source space it will be imported as draft to your destination space.
But maybe we should actually still keep the asset in draft but process it to avoid that broken bhaviour.
I’ll see what I can do.
Best,
Khaled

1 Like

Hi @khaled

This is an huge issue for us, we have 7 different spaces and I must publish assets
before I can clone one space to another.

Vincenzo

Hi @vmilone,
This is actually fixed, in the @next version
If you npm i contentful-import@next you should get the fixed version. You can work with that for now until we make a final release.

Best,
Khaled

1 Like

Hi @khaled,

I’ve tried with contentful-import@5.0.1 but unfortunately the problem is the same.

It’s possible that I’m doing something wrong? I must update contentful-export?

Hi @vmilone,

Have you also tried it with next version? next is the name of latest beta version.
So, you can get it like Khaled mentioned earlier: npm i contentful-import@next

Hey @vmilone,

Benedikt here, one of our JS tooling maintainers.

Sorry for the confusion, we just found out, that we actually did not merge the bugfix into the next branch.

We are currently reviewing the branch and will publish a new beta version today or tomorrow including the bugfix.

I keep u posted here.

All the best,
Benedikt

1 Like

Hi @benedikt,

thank you for the support.

1 Like

Hi @benedikt,

Is there any update?

Hi @vmilone,

Sorry for that!
We’re very busy releasing main JS SDK https://github.com/contentful/contentful.js/releases and unfortunately, had no time to tackle this issue with import tool. Apologize for the inconvenience!
We’re doing our best to make this happen very soon, but I don’t want to give you false promises (simply because of other urgent issues). We don’t have strict milestone for releasing new import version, but, again, hopefully it’s gonna happen soon.

Hey @vmilone,

I got good news. We were able to merge the branch which includes the bugfix, I upgraded the tool to use the latest SDK version and released a new beta version.

Just download it via npm install -g contentful-import@next

Besides of sweeter output, it should also now process draft assets. Please let me know if that worked now for you.

All the best,
Benedikt

1 Like

Hi @benedikt

I’ve installed 5.0.2-beta1 version and then I launched my scripts. Some of assets are correctly uploaded and processed but during the “Import assets” task the script crashed.

Here is the full error message:
https://gist.github.com/vincenzomilone/0e5d54b726b8f01ff97bdbf7a31e8a37

If you want I can share with you the export file that I’m trying to import.

Hi @vmilone,

Yes, could you please send us the export file? I kindly ask you to move this conversation to our official support channel in order to keep files safe and as further investigation is required.
Could you please send us details and the export file at support@contentful.com or via Submit ticket form: https://www.contentful.com/support/ ?

Thanks a lot and once again sorry for the inconvenience!:cry:

Hi @andrey,

You have right! I’ve opened a support ticket.

Thanks

1 Like

@vmilone excellent! Thank you very much. Received it.

Did anything come out of this effort? I’m seeing the exact same problem now. I can re-export and import using the new libraries but I’d like some insight.

Hi @dustin.aleksiuk,

the issue is resolved by contentful-import@5.0.2-beta2

You can install it with

npm install contentful-import@next

Vincenzo

1 Like

Thank you @vmilone!
@dustin.aleksiuk correct, the issue should be fixed. Let me know if still see the problem.