question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Repeated "MastoUnprocessableEntityError" on upgrade from masto.js 2.x to 3.x

See original GitHub issue

Hi, I upgraded from masto@2.5.4 to masto@3.5.1 and renamed the uploadMediaAttachment method and response object parameters as indicated by the breaking changes in the release notes for 3.0.0, but now I’m getting a MastoUnprocessableEntityError whenever I try to make a post with uploaded media. Previously it used to work fine.

The full error:

MastoUnprocessableEntityError: Cannot attach files that have not finished processing. Try again in a moment!

The code I was using with masto@2.5.4, which worked fine:

// ...

const { id } = await masto.uploadMediaAttachment({
  file: createReadStream(filename),
  description: title
});

const { created_at, uri } = await masto.createStatus({
  status: title,
  visibility: "public",
  media_ids: [id]
});

The code I am using with masto@3.5.1, which throws the exception:

// ...

const { id } = await masto.createMediaAttachment({
  file: createReadStream(filename),
  description: title,
});

const { createdAt, uri } = await masto.createStatus({
  status: title,
  visibility: "public",
  mediaIds: [id],
});

Is it possible this is a change in the Mastodon API behaviour introduced in 3.1.0 when using the v2/media endpoint? If so, that seems like a breaking change.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
neetcommented, Mar 26, 2021

As of masto@4.0.0, the polling is enabled by default. To skip waiting for the media process and access the incomplete data, you can use new skipPolling param available in both mediaAttachments.create and mediaAttachments.update. https://neet.github.io/masto.js/interfaces/repositories_media_attachment_repository.createmediaattachmentparams.html#skippolling

1reaction
neetcommented, Sep 30, 2020

@lostfictions I’ve totally forgotten about that. I added a timeout handling in #305 and shipped as v3.6.2. You can configure by

Masto.login({
  // ...
  defaultConfig: {
    timeout: 3000,
  },
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

masto - npm
Mastodon API client for JavaScript, TypeScript, Node.js, browsers. Latest version: 4.9.1, last published: 5 days ago. Start using masto in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found