Skip to content

Incorrect data is return when retrieving DAM assets #242

@YnzeNunnink

Description

@YnzeNunnink

I've run into an issue with retrieving DAM image assets using the SDK. When retrieving the asset, isDamImageAsset always returns false, and the __typename is Data.

The cause appears to be that cmp_PublicImageAsset needs to inherit from _IContent in order to retrieve the image content/data using the SDK's Graph fragment. As can be seen in the image below, that is not the case in my Graph instance. I have tried to reset my instance and re-sync with no luck.

Is this an issue with my Graph instance or with the SDK?

AI Issue Summary
The Optimizely CMS SDK (@optimizely/cms-sdk) automatically appends a fragment (... on cmp_PublicImageAsset) to ContentReference fields when DAM assets are enabled. However, the SDK assumes that these assets can be queried through the standard _IContent interface (which underpins ContentReference items).

The Problem: In the specific Optimizely Graph schema configuration encountered, the cmp_PublicImageAsset type does not implement the _IContent interface.

Consequently: When the SDK generates a query that attempts to spread ... on cmp_PublicImageAsset inside a field typed as _IContent (or ContentReference pointing to _IContent), the GraphQL engine rejects the query with a validation error: "Fragment cannot be spread here as objects of type '_IContent' can never be of type 'cmp_PublicImageAsset'".
Result: The SDK fails to retrieve DAM asset data entirely or returns partial data, necessitating manual workarounds.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions