thumbAsset.setContent throws an error

Hello, I am trying to update the content of thumbAsset

public updateThumbnailImage(thumbAssetId, fileData: File) {
    this.getClient().then((client: KalturaClient) => {
        const uploadAction = new UploadUploadAction({
            fileData: fileData
        } as UploadUploadActionArgs);

        client.request(uploadAction).subscribe((token: string) => {
            const uploadedFileTokenResource = new KalturaUploadedFileTokenResource({
                token: token
            } as KalturaUploadedFileTokenResourceArgs)

            console.log('Token', uploadedFileTokenResource);
            const updateContentAction = new ThumbAssetSetContentAction({
                id: thumbAssetId,
                contentResource: uploadedFileTokenResource,
            } as ThumbAssetSetContentActionArgs);

            client.request(updateContentAction).subscribe((thumb: KalturaThumbAsset) => {
                console.log('Updated thumb', thumb);

I am getting this error

[API] [KalturaFrontController->getExceptionObject] ERR: exception ‘KalturaAPIException’ with message ‘Upload token not found’ in /opt/kaltura/app/api_v3/lib/types/resource/KalturaUploadedFileTokenResource.php:25

Stack trace:

#0 /opt/kaltura/app/api_v3/lib/types/resource/KalturaDataCenterContentResource.php(21): KalturaUploadedFileTokenResource->getDc()

Please let me know if it is the correct way, BTW i can upload new thumbnails just fine.


Hi @abrar,

I don’t see where in your code you’re creating a upload token?
You can use this tutorial as a starting point:;step=intro

It’s not exactly what you need but by following it you’ll gain an understanding of how uploading works in general.

Hi @jess,

Thank you for the reply. A little confusion here, Typescript library does not have yet UploadToken.Add Action for now but according to the documentation KalturaUploadedFileTokenResource accepts the token as String and that could be generated from upload.upload or TokenUpload.add. I am generating the token from UploadUploadAction which also uploads the file at the same time, the token returned from this API is wrapped by KalturaUploadedFileTokenResource and passed to ThumbAssetSetContentAction.

I can see in the log the file is uploaded in tmp folder which seems to be fine until this point but cannot find the token.

I guess i have to call the UploadToken.Add manually if that token is different from upload.upload action?