Skip to content

Posts over 300 characters cause errors #2

@nfriedly

Description

@nfriedly

Mastodon has a default limit of 500 characters per post (and I believe the underlying protocol enables even longer posts), whereas bluesky has a limit of 300.

So, this script should probably split posts > 300 characters into multiple posts for bluesky, with the all subsequent ones being a reply to the first. Maybe add a (1/2) and (2/2) to the end of each post.

This is the error I got:

/config/workspace/mastodon-to-bluesky/node_modules/@atproto/api/dist/index.js:15637
        throw new XRPCError(resCode, res.body.error, res.body.message, res.headers);
              ^

XRPCError: Invalid app.bsky.feed.post record: Record/text must not be longer than 300 graphemes
    at ServiceClient.call (/config/workspace/mastodon-to-bluesky/node_modules/@atproto/api/dist/index.js:15637:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async PostRecord.create (/config/workspace/mastodon-to-bluesky/node_modules/@atproto/api/dist/index.js:26620:17)
    at async postToBluesky (/config/workspace/mastodon-to-bluesky/main.js:48:3)
    at async fetchNewPosts (/config/workspace/mastodon-to-bluesky/main.js:77:7) {
  status: 400,
  error: 'InvalidRequest',
  success: false,
  headers: {
    'access-control-allow-origin': '*',
    'content-length': '123',
    'content-type': 'application/json; charset=utf-8',
    date: 'Thu, 14 Mar 2024 13:52:26 GMT',
    etag: 'W/"7b-5OYjOucrkx456vG6nIBiH/VZWIA"',
    'keep-alive': 'timeout=90',
    'ratelimit-limit': '5000',
    'ratelimit-policy': '5000;w=3600',
    'ratelimit-remaining': '4994',
    'ratelimit-reset': '1710427946',
    'strict-transport-security': 'max-age=63072000',
    vary: 'Accept-Encoding',
    'x-powered-by': 'Express'
  }
}

Node.js v20.9.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions