Skip to content
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

XRPCError: Invalid app.bsky.feed.post record: Record/text must not be longer than 300 graphemes #115

Closed
kai17 opened this issue Nov 3, 2023 · 5 comments · Fixed by #120
Assignees
Labels
bug Something isn't working mastodon

Comments

@kai17
Copy link

kai17 commented Nov 3, 2023

With the latest version (commit cceb9d), touitomamout pulls the tweets from https://twitter.com/kai_arzheimer and reposts them at https://bsky.app/profile/kaiarzheimer.bsky.social. However, it chokes on this tweet https://twitter.com/kai_arzheimer/status/1716520276488249713 with an error about using more than 300 graphemes (the tweet is definitively shorter). The script than hangs for a few seconds before terminating. My more recent tweets do not get synchronised. Instead, my older tweets get duplicated on Bluesky.

@kai17 kai17 added the bug Something isn't working label Nov 3, 2023
@louisgrasset
Copy link
Owner

I'll look into that. I added some checks in the codebase, they are already passing... 🤔

@louisgrasset
Copy link
Owner

A fixed has been merge regarding the duplication. It was related to a cache migration failure.
If you want to start the sync from a specific tweet, you can add the following in your cache file:

{
...
posts: {
    ...
    "yourTweetIdHere": {
       mastodon: ["correspondingMastodonId"]
    }
    ...
}
...
}

@kai17
Copy link
Author

kai17 commented Nov 4, 2023

Thank you again. I just pulled from github and ran the script again, but the result is the same (see the attached screenshot). The first part of the tweet (w/ot the link) is posted again on Bluesky (now for the 9th time), then the script hangs for a few seconds and terminates.
Should I try deleting the cache and/or reinstall from scratch?
screenshot

@louisgrasset
Copy link
Owner

louisgrasset commented Nov 4, 2023

Sounds like the AtProto relies on Graphemer to count text length, not on a simple string.length.

From what I see, the atProto checks the text length using the following code:

// counts the number of graphemes (user-displayed characters) in a string
export const graphemeLen = (str: string): number => {
  const splitter = new Graphemer()
  return splitter.countGraphemes(str)
}

Thanks to your issue & details, I'll try to reproduce & find a fix

@louisgrasset
Copy link
Owner

@kai17 I let you test the latest codebase or dev tag on docker

Feel free to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mastodon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants