Embed image doesn't show since couple of days.

I am not sure if it is discord.js problem. My bot once a day posts 3 embeds with images. In 2 of 3 embeds images are displayed correctly, in last embed image is not displayed at all since 5 days. I checked embed source, image url and proxy_url are set correctly, however image width and height is 0. When i open that image url (from not working embed) in the browser it clearly shows image is 560 x 400 px. When i open image from working embed it shows the same thing. Even weirder is that, if i request exactly the same embed with slash command, it displays image correctly, problem exists only with automated posts with cron. discord.js - 14.16.3 node.js - 20.16.0 OS - Ubuntu 20.04
const embed = new EmbedBuilder()
.setColor('#cc0000')
.setThumbnail(`${basePath}/icon.png`)
.setImage(`${basePath}/locations/${id.toLowerCase()}.png`);

const sentMessage = await channel
.send({
embeds: [embed],
})
.catch(console.log);
const embed = new EmbedBuilder()
.setColor('#cc0000')
.setThumbnail(`${basePath}/icon.png`)
.setImage(`${basePath}/locations/${id.toLowerCase()}.png`);

const sentMessage = await channel
.send({
embeds: [embed],
})
.catch(console.log);
Is there any way i can force width and height of that image inside embed?
2 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Michal__d
Michal__dOP3mo ago
i checked it twice, console.log(JSON.stringify(sentMessage.embeds)) right after bot sent that message, and also fetched message by id, both are identical: (paths are different than in original post because i tested if that's cache issue, but nothing changed)
[
{
"type": "rich",
"thumbnail": {
"width": 256,
"url": "https://raw.githubusercontent.com/MichalD96/rdodailies.com-website/master/images/nazar/collector_icon.png",
"proxy_url": "https://images-ext-1.discordapp.net/external/eQDI24DH2eq9awZwmhmnJc8v0Ytow8JryDWvCpM44rY/https/raw.githubusercontent.com/MichalD96/rdodailies.com-website/master/images/nazar/collector_icon.png",
"height": 256,
"flags": 0
},
"image": {
"width": 0,
"url": "https://raw.githubusercontent.com/MichalD96/rdodailies.com-website/master/images/nazar/mpsw_location_01.png",
"proxy_url": "https://images-ext-1.discordapp.net/external/HQcA1AcQYddcI2yRHffJAVo1-MueTl6PO4PeNoiTfwM/https/raw.githubusercontent.com/MichalD96/rdodailies.com-website/master/images/nazar/mpsw_location_01.png",
"height": 0,
"flags": 0
},
"content_scan_version": 1,
"color": 13369344
}
]
[
{
"type": "rich",
"thumbnail": {
"width": 256,
"url": "https://raw.githubusercontent.com/MichalD96/rdodailies.com-website/master/images/nazar/collector_icon.png",
"proxy_url": "https://images-ext-1.discordapp.net/external/eQDI24DH2eq9awZwmhmnJc8v0Ytow8JryDWvCpM44rY/https/raw.githubusercontent.com/MichalD96/rdodailies.com-website/master/images/nazar/collector_icon.png",
"height": 256,
"flags": 0
},
"image": {
"width": 0,
"url": "https://raw.githubusercontent.com/MichalD96/rdodailies.com-website/master/images/nazar/mpsw_location_01.png",
"proxy_url": "https://images-ext-1.discordapp.net/external/HQcA1AcQYddcI2yRHffJAVo1-MueTl6PO4PeNoiTfwM/https/raw.githubusercontent.com/MichalD96/rdodailies.com-website/master/images/nazar/mpsw_location_01.png",
"height": 0,
"flags": 0
},
"content_scan_version": 1,
"color": 13369344
}
]
when i request that embed with slash command, width and height are set correctly. Part of the code to create embed is shared with cron and slash command, Other embeds that works fine are structured the same way. Maybe something is wrong with that images, but it was working fine for over 3 years. That's odd because images in embeds that always works are from the same GitHub repository just a different folder That images has a few kilobytes I am well below the limit of 2GB / month I have CDN and i will try it But i send that in 3 separated messages. Each message is independent because wait for the script that fetch data from the game API Usually there is 15 seconds time difference between that messages And that not working embed is usually first yes, the thumbnail always shows up, but is also much smaller I will try with CDN That's not issue with content delivery time. Images from Google CDN also doesn't work. When i use AttachmentBuilder to attach image directly to the embed, is exactly the same problem. Embed source gives correct working url and proxy_url, but width and height is 0

Did you find this page helpful?