Contentful logo

Contentful Community

extension.space.unpublishAsset always returns 404

Hi, inside my extension (webpack transpiled, hence the async syntax) I’m having some issues with my contentful extension refusing to unpublish assets for me.
whenever the function below is called, i receive a 404 network request for the unpublishAsset. Im running this in a separate development environment in contentful, no on the master env.

when inspecting that specific request, I can see that somehow it is calling the wrong endpoint in the API? (space ids and environment removed from example below)
https://api.contentful.com/spaces/{MY_SPACE_ID}/environments/{MY-ENVIRONMENT_ID}/content_types/12AZ0KOv9gKKS0JXfztDHu/published

Should this not be the the /assets/ endpoint rather than the /content_types/ ?
based on the documentation found here: https://www.contentful.com/developers/docs/extensibility/ui-extensions/sdk-reference/
I should be calling unpublish according the following signature: space.unpublishAsset(data), which is a bit confusing as data is a very vague term IMHO.

I’m including the Extensions SDK like this in my root html:
<script src="https://unpkg.com/contentful-ui-extensions-sdk@3"></script>

  const removeUploadedFiles = async (id, extension) => {
    const { space, notifier } = extension // properly initialized contentful extension.
    try {
      notifier.success('Removing uploaded image with id', id)
      const asset = await space.getAsset(id)
      if (asset) {
        // this code always fails with error 404 on unpublish
        const unpublishedAsset = await space.unpublishAsset(asset)
        // this function call also fails with 404.
        const unpublishedAsset = await space.unpublishAsset(asset.sys.id)
        notifier.success('uploaded image unpublished')
      }
    } catch (err) {
      notifier.error('error unpublishing asset')
    }
  }

is this a known bug with unpublishAsset or am I simply misunderstanding how to use the api?