Skip to content

Mastodon uploadMedia fails in Docker #2265

@ASTRELION

Description

@ASTRELION

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions