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
"Could not redirect due to an unexpected error" when attempting to boost a post on where unauthenticated access to public toots is not possible #71
Comments
Thanks for the report. Is this always reproducible? Also, if you have that error, could you please go to Could you copy potential log messages from there please? For more information, see this guide: https://extensionworkshop.com/documentation/develop/debugging/#debugging-background-scripts |
If I visit https://types.pl/api/v1/statuses/108431355656120911 directly, I get "This method requires an authenticated user" (it's for the public post I listed above). So far it reproduces 100% on specific posts. But not every post will result in this. I've been trying to find a pattern (Mastodon version, locked accounts, forks such as glitch-soc) and so far I can't find a consistent pattern. I have seen it both work and fail with locked accounts. Something seems to be blocking that API's access in some situations. Not sure if its a server configuration or something like that. |
Thanks a lot, first of all.
That is interesting and apparently a well-known issue, but also already fixed in the current dev version. Also, that code part is only triggered when an actual notification is shown, so I guess it is not related to the origin error. |
So I could reproduce this with the toot you mention, both with the stable version you use and the current dev version (973bbd9). ProblemThe problem seems to be the add-on tries to fetch information via the official Mastodon API at https://types.pl/api/v1/statuses/108431355656120911 However, the server you have there rejects that with “401 Unauthorized” and „This method requires an authenticated user” in the JSON body. As for this add-onThat all said, while that original issue is an instance-specific issue, the add-on should have some way to deal with that. For a high-level overview of how it works, please first see the Readme. All in all, it has some fallback inside and also does website/HTML scraping if it needs that (you can usually BTW see that if you can see the popup being loaded until the end/it takes some more seconds). That would/should work here, however, I've found a bug: To implement such a fallback mechanism the extension races two promises against each other here, which have these two methods implemented:
Promise.race just has the issue that it also rejects as soon as a promise rejects, i.e. errors. We want to ignore errors. I.e. I found something like this SO questions asks for, which points to the modern browser-implemented solution called |
This isn't only seen on that fork, unfortunately. I am seeing it for this post, for example: https://mellified.men/@srol/108472559455355925 That instance is on mainline 3.5.2 Mastodon. Just to clarify the issue's scope. I still haven't discovered specifically what differentiates the instances with the issue, and the instances without. Though it does seem to depend on the instance. So presumably it's some server setting. |
Ah interesting, thanks for your information. It's indeed the same issue. Anyway my PR should fix/handle that, too. Interesting though that even when I am not authenticated I can access them via the web interface, which makes that setting kinda dubious… If this continues to be a problem, we could only implement a login via OAuth, which WebExtensions specifically support. However, that would not help here given that we would need to authenticate to foreign server… so uff… |
Bug description
When I click the Boost button to try to boost a remote post, I get an error notification from the addon that says "Could not redirect due to an unexpected error". Following the account does seem to work, however.
Steps to reproduce
Actual behavior
A standard Mastodon popup appears, and a notification popup also appears:
Expected behavior
The simplified federation popup appears to confirm you want to boost the post. Or the post is opened in the user's local mastodon feed.
System
Operating system and version: Gentoo linux 5.15.41
Browser and version: Firefox 91.10.0esr
Add-on version: 1.3
The text was updated successfully, but these errors were encountered: