Unsupported command: attachment-thumbnail

Hi,

I am getting an unsupported command error. Can you someone please check it? Please check the below code

TrelloPowerUp.initialize({
‘card-buttons’: function (t, options) {
return [{
icon: ‘https://www.bynder.com/favicon-32x32.png’,
text: ‘Bynder’,
callback: function (t) {
t.modal({
title: “Bynder”,
url: ‘bynder.html’,
accentColor: ‘#0099FF’,
fullscreen: true,
callback: () => console.log(‘Goodbye link.’),
});
}
}];
},
‘attachment-thumbnail’: function (t, options) {
// createdBy, modifiedBy
if (options.name != undefined || options.name != null) {
return {
title: options.name,
image: {
url: ‘https://www.bynder.com/favicon-32x32.png’,
logo: true // false if you are using a thumbnail of the content
}
};
}
else {
throw t.NotHandled();
}
},
‘attachment-sections’: function (t, options) {
return ;
},
‘authorization-status’: function(t, options){
// return a promise that resolves to the object with
// a property ‘authorized’ being true/false
// you can also return the object synchronously if you know
// the answer synchronously
return new TrelloPowerUp.Promise((resolve) => resolve({ authorized: true }));
}
});

Generally, that means that your Power-Up has the attachment-thumbnail capability turned on in the Power-Up admin portal, but your Power-Up is not initializing it. But because your Power-Up connector initializes it (as seen by your code here), you shouldn’t be seeing that error message.

Are you sure the warnings/errors you’re seeing are for the Power-Up whose code you are sharing? Generally the warnings/errors include the Power-Up’s ID. That ID should match the one that you are working on.

I am not getting the power-ups id in the console but below is the error I am getting.

Hi, Any updates?

That error leads me to believe that something is happening that you’re not catching in the attachment-thumbnail capability.

Have you tried wrapping capability handler in a try and catch the error?

Something like:

‘attachment-thumbnail’: function (t, options) {
  // createdBy, modifiedBy
  try {
    if (options.name != undefined || options.name != null) {
      return {
        title: options.name,
        image: {
          url: ‘https://www.bynder.com/favicon-32x32.png’,
          logo: true // false if you are using a thumbnail of the content
        }
      };
    } else {
      throw t.NotHandled();
    }
  } catch (err) {
    console.log(err)
  }
}

Still, it is not resolving

The following appears to work for me:

TrelloPowerUp.initialize({
  'card-buttons': function (t, options) {
    return [{
      icon: 'https://www.bynder.com/favicon-32x32.png',
      text: 'Bynder',
      callback: function (t) {
      t.modal({
      title: "Bynder",
      url: 'bynder.html',
      accentColor: '#0099FF',
      fullscreen: true,
      callback: () => console.log('Goodbye link.'),
      });
      }
      }];
  },
  'attachment-thumbnail': function (t, options) {
    // createdBy, modifiedBy
    if (options.name != undefined || options.name != null) {
      return {
        title: options.name,
        image: {
          url: 'https://www.bynder.com/favicon-32x32.png',
          logo: true // false if you are using a thumbnail of the content
        }
      };
    } else {
      throw t.NotHandled();
    }
  },
  'attachment-sections': function (t, options) {
    return [];
  },
  'authorization-status': function(t, options){
    // return a promise that resolves to the object with
    // a property 'authorized' being true/false
    // you can also return the object synchronously if you know
    // the answer synchronously
    return new TrelloPowerUp.Promise((resolve) => resolve({ authorized: true }));
  }
});