I have a strange issue where uploadMedia will fail with an Axios 500 error only if a description is provided, it's running in Docker, and seemingly any other client function is called at some point before (in my example, it's verifyAccountCredentials)
If I'm not in Docker, or I don't verifyAccountCredentials, or I don't provide a description, everything works fine. Interestingly, if I set this up to keep retrying uploadMedia on an exponential interval, it will keep failing for 10-15m, and then eventually succeed.
For example, this code will fail:
import generator from "megalodon";
import fs from "fs";
const client = generator("mastodon", "https://mastodon.social", "MY_ACCESS_TOKEN");
await client.verifyAccountCredentials(); // or seemingly any other client call like postStatus, getInstance, etc.
const media = await client.uploadMedia(fs.createReadStream("/tmp/0195e836-01c0-7000-a91a-f90d85a62f21.png"), { description: "Hello" }); // axios 500 error here
const post = await client.postStatus("hello", { media_ids: [media.data.id] });
But both of these examples will not fail:
import generator from "megalodon";
import fs from "fs";
const client = generator("mastodon", "https://mastodon.social", "MY_ACCESS_TOKEN");
// note lack of verifyAccountCredentials
// await client.verifyAccountCredentials();
const media = await client.uploadMedia(fs.createReadStream("/tmp/0195e836-01c0-7000-a91a-f90d85a62f21.png"), { description: "Hello" });
const post = await client.postStatus("hello", { media_ids: [media.data.id] });
// successfully uploads and posts
import generator from "megalodon";
import fs from "fs";
const client = generator("mastodon", "https://mastodon.social", "MY_ACCESS_TOKEN");
await client.verifyAccountCredentials();
const media = await client.uploadMedia(fs.createReadStream("/tmp/0195e836-01c0-7000-a91a-f90d85a62f21.png")); // note the lack of description
const post = await client.postStatus("hello", { media_ids: [media.data.id] });
// successfully uploads and posts
(The above examples were all ran via an identical Dockerfile)
I have a strange issue where
uploadMediawill fail with an Axios 500 error only if adescriptionis provided, it's running in Docker, and seemingly any other client function is called at some point before (in my example, it'sverifyAccountCredentials)If I'm not in Docker, or I don't
verifyAccountCredentials, or I don't provide adescription, everything works fine. Interestingly, if I set this up to keep retryinguploadMediaon an exponential interval, it will keep failing for 10-15m, and then eventually succeed.For example, this code will fail:
But both of these examples will not fail:
(The above examples were all ran via an identical Dockerfile)