Resending image in embed doesn't work on production, but works on dev
Hello, I have an function, that will resend any picture from a channel to another but in embed
Workflow is Channel A gets a message with picture -> picture gets broken down to a base64 stream -> saved to a sequelize database as a Sequelize.TEXT data type-> Loaded using fs to create the image into local directory -> Loaded using attachmentBuilder and then used in setImage() -> Then Bot sends that embed into a channel B
This all works on my computer when testing, but when deployed on production env, the images are broken and not working as it seems as seen in picture
6 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.This is what happens on production when I open the image
This is while on local machine
I need to work with those images in outside of this scope. It's also an archiver and we've ran into issues where discord cdn deletes files after a while, when the original message is deleted -> hence defeating the purpose of archiving
Also it's fixed, if anyone stumbles upon a similiar issue, good luck, it's hell.
In summary the issue was caused either by something weird, or these issues:
- fs acts different on linux than windows
- It didnt process the image correctly in the stream (Happens even now, but I made a reprocessing function as a workaround)
I ended up compressing the images to 70% quality (Which I should've done at the start lol)
It works okayish now, which is acceptable for me
Nope, permissions were fine, it saved/deleted images as expected. File existed, and existed in time for it to get processed
Thank you for providing solutions, i'll close this post since it's fixed