-
-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to load resource on sendImage #2961
Comments
I'm having the same issue, "MediaFileEmpty", sending images or audio files. I am using an ARM CPU, and you? |
on production server using DO-Premium-Intel. |
I'm also trying to send an image from an URL and it's throwing the following error on file
I haven't tried yet downloading the image before sending it. My code: this.client.sendImage(
message.from,
url,
'Youtube Thumbnail',
caption
);
|
@crescent1 the issue is clearly laid out in the logs:
The URL is returning 404 which is why the media file is empty. For some reason when I try your link it works fine here. Ensure the URL is valid before trying to send it as a file source. |
@TramontaG what's your node version?
|
I tried using v19.0.1 and v18.12.1, same error on both |
@TramontaG that's not a solution. Please provide reproducible code and the file you are trying to send |
The following exact code works on 4.46.0 but doesnt on 4.51.0 client.onAnyMessage(message => {
try {
if (message.body === "!dev_test"){
client.sendImage(
message.from,
"https://www.belasmensagens.com.br/wp-content/uploads/2015/03/bom-dia-amigos-400x300.jpg",
"testMessage",
"sample caption",
message.id,
)
return;
}
} catch (e) {
console.warn(e);
}
} For version 4.51.0 i get the following error:
For version 4.46.0 I get no errors and the expected result: |
Yeah, when i try on local development its work fine too, but give error after push to production, for now i am using |
Something regarding media delivery broke in this new version. I found that a module of mine that downloads songs from youtube was also crashing the bot after the update, even though i haven't changed a single line of code. Downgrading the lib made it work properly again. |
@github-actions run ⚡ Release! ⚡(async () => {
function exec(cmd) {
try {
execSync(cmd, {stdio: 'inherit'})
} catch (error) {
console.log(`Status Code: ${error.status} with '${error.message}'`);
}
}
//set the version type
process.env.VERS = "patch"
// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";
exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i -D`);
exec(`npm run release-ci $VERS`);
// types only package
exec('npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN')
exec(`npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN && npm run types:publish `);
exec(`git commit -a -m 'updated types-only package'`);
exec(`git push --force`);
//comment on the issue
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();
await postComment(result);
//create changelog image
exec(`npm run release-image`);
exec(`git commit -a -m 'updated release-image'`);
exec(`git push --force`);
})(); |
@TramontaG the reason you're facing this issue is because you do not enter a valid filename for the image (should be Now I've updated the implementation of mime to the latest version. Please update and try again |
Even with the update, i still having the error "MediaFileEmpty". |
@luizgununes share some code with hardcoded values that gives u this error. |
Here the code that gaves me the error. I've tried everything!
|
Ah, I almost forgot. This error only happens in the production. Running on my computer works fine. |
@luizgununes use relative file references. media/.... should be ./media/...... |
Update:
The error now is: |
@luizgununes can you take a screenshot of your folder structure please. Clearly the library cannot find the file you are referring to. The library tries to check the file relative to the current working directory of the node process.
If you run so in order to get oof.mp3 you will need to use |
|
Any news? I'm still stuck with this problem. Tried with another WhatsApp library and works fine, but I don't wanna migrate everything. |
@luizgununes you can try using a full filepath instead of relative if you're still facing this problem. Clearly the library is unable to find the file. If you hop in the discord (click the discord badge in the readme) then I can help you out there. Closing as original issue is resolved. |
@luizgununes |
@eladcandroid Did you found the solution? |
bump. Can you both add the details of the issues you are having please. |
Thank you for your help! I'm trying to send media using the open-wa library. I've tried the following methods from the documentation so far: sendImage
I've successfully generated the base64 string and tested it elsewhere, where it worked perfectly. I also tried sending publicly accessible URLs, but I still encountered the same error. |
Are you using the latest version of the library?
What type of session are you experiencing this issue on?
Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag
What type of host account are you experiencing this issue on?
Personal account (normal)
Mode
My own code
Current Behavior
image failed to send (work fine on local development)
Expected Behavior
image sent successfully
Steps To Reproduce
client.sendImage( [email protected], https://drive.google.com/uc?id=19EXFscynB351dXfdPAL_PadPP0PeoH2R&export=download, basket.jpg, basket.jpg, null, false, false, false, false, false );
create() code OR full CLI command + CONFIG
DEBUG INFO
Environment
Screenshots/Logs
Anything else?
The text was updated successfully, but these errors were encountered: