Skip to main content
Question

getSizeAsync() creates browser Datadog error

  • December 23, 2025
  • 0 replies
  • 4 views

Michael Barsotti

Hello,

I’m creating a Figma plugin that collects data from the Figma file, I’m trying to get an image original dimensions but when calling getSizeAsync() I get a browser console log data dump, I also get the correct dimensions so I’m not sure what I’m doing wrong. This is my code:
 

const fills = (node).fills;
if (fills && Array.isArray(fills)) {
// Iterate over each fill
for (const paint of fills) {
if (paint.type === 'IMAGE' && paint.imageHash) {
// Bitmap image detected!
const img = figma.getImageByHash(paint.imageHash);
const { width, height } = await img.getSizeAsync();
const bytes = await img.getBytesAsync();
//convert bytes to base64
const base64String = figma.base64Encode(bytes);
let returnObj = { type: await detectImageFormatFromBytes(bytes), base64String: base64String, hash: paint.imageHash };
return returnObj;
}
}
}
return false;

when I include the line

const { width, height } = await img.getSizeAsync();

I get the following in my Browser console log

Datadog Browser SDK: The data provided has been discarded as it is over the limit of 225280 characters: IMG[src=data:image;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/4QAC/9sAhAABAQEBAQEBAQEBA…

That base64 string goes on for 1.2 MB

When I remove getSizeAsync I do not get this console log warning.

I’m getting the data I need, but don’t understand why I get this browser warning and server crash. Any help or suggestions are appreciated.