NicolasConstant / BirdsiteLive

An ethical bridge from Twitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Following of Twitter accounts on Mastodon stuck in "awaiting approval"

yogan opened this issue · comments

Sorry for raising an issue for something that is very likely a user error, but I have tried anything that I could think of and really ran out of ideas…

I have set up my own BSL instance via Docker, and it seems to be running just fine:

  • searching for @SomeTwitterUser@<my.bsl.instance.tld> on my Mastodon instance finds that user
  • when I click the follow button, it seems to work, but the follow request seems to be stuck waiting for some kind of approval

I have to reload the Mastodon instance page and do the search for @SomeTwitterUser@<my.bsl.instance.tld> again to see this.

For debugging purposes, I tried this with my own old Twitter account, and it also leads to this:
image
(screenshot from my Mastodon instance)

Is this how it is supposed to be? Does the Twitter user that I want to follow on Mastodon have to agree in some way? Would be understandable, but I cannot see how they would even notice that and be able to do so. My own Twitter account did not get any kind of notification or request after I initiated the Mastodon follow request.

I have checked the /statistics page, and rather suspect something not working as intended:
image

There are no errors in the Docker logs, though, all I can see are some info messages:

2023-01-30T15:51:11.573978774Z info: System.Net.Http.HttpClient.Default.LogicalHandler[100]
2023-01-30T15:51:11.574060914Z       Start processing HTTP request GET https://<my.mastodon.instance>/users/<my-mastodon-handle>
2023-01-30T15:51:11.574071601Z info: System.Net.Http.HttpClient.Default.ClientHandler[100]
2023-01-30T15:51:11.574080468Z       Sending HTTP request GET https://<my.mastodon.instance>/users/<my-mastodon-handle>
2023-01-30T15:51:11.577685621Z info: System.Net.Http.HttpClient.Default.ClientHandler[101]
2023-01-30T15:51:11.577853231Z       Received HTTP response headers after 3.7851ms - 200
2023-01-30T15:51:11.577866779Z info: System.Net.Http.HttpClient.Default.LogicalHandler[101]
2023-01-30T15:51:11.577875627Z       End processing HTTP request after 3.8868ms - 200

Any hints on what could be wrong here and how I could analyze this better?

Normally BSL's follow request are immediately accepted and the account should switch this pending status to the followed state. So that mean the accept request isn't going through.

Sometime there is issue with wrongly set SSL, maybe check your domain with a SSL checker like this one and see if there is anything off.

Also, if you're trying to follow it from chaos.social (since it's the instance on one of your screen) you should know this is a big instance that is blocking BSL instances so maybe they have some settings against BSL activity; maybe try your instance from a personal/temporary one to check if it's a BSL issue, or an instance policy.

Thanks, those are very good hints. Cert seems fine (it's from LetsEncrypt), SSL Labs gives an A rating.

But that chaos.social is blocking seems very likely. I wonder how, though, since they could not have known about my freshly set up instance. BSL accounts are tagged as bots, right? Bots are not allowed on chaos.social. Though they are not running there, but on my instance, I merely want to follow them… which works for various others bot accounts from other instances.

Anyway, I'll try with a new account on some other instance with less strict rules and see if that works.

No luck. :-(

I've created a new account on layer8.space, searched for a few Twitter accounts (which are found), clicked follow, and they are stuck in "awaiting approval".

The /statistics page now at least has on call count that is not 0:

image

Though I have tested with about 5 accounts, so no idea why it's 2.

Docker logs still only shown info: System.Net.Http.HttpClient.Default.LogicalHandler[100] / Start processing HTTP request GET https://layer8.space/users/yogan entries (now with the new Mastodon instance of course).

BSLManager shows no data at all.

Where else could I look? Can I somehow increase logging verbosity, or dig around in the database somehow?

You can change the log level by adding this to you docker-compose:

services:
    server:
        image: nicolasconstant/birdsitelive:latest
        restart: always
        container_name: birdsitelive
        environment:
+            - Logging:LogLevel:Default=Trace

You can have more detailed information on this tooling here and here.

Does other instances of BSL works properly with the account you're testing this?

Hmm, now things are getting weird… I've increased the logging level as you have suggested, and then saw this in the logs after a restart and a follow request:

fail: BirdsiteLive.Twitter.Tools.TwitterAuthenticationInitializer[0]
      Twitter Authentication Failed
System.AggregateException: One or more errors occurred. (Name or service not known)
 ---> System.Net.Http.HttpRequestException: Name or service not known
 ---> System.Net.Sockets.SocketException (0xFFFDFFFF): Name or service not known
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Tweetinvi.WebLogic.HttpClientWebHelper.GetHttpResponse(ITwitterQuery twitterQuery, ITwitterClientHandler handler)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Tweetinvi.WebLogic.WebRequestExecutor.<>c__DisplayClass4_0.<ExecuteQuery>b__0()
   at Tweetinvi.WebLogic.WebRequestExecutor.ExecuteTwitterQuerySafely[T](ITwitterQuery twitterQuery, Func`1 action)
   at Tweetinvi.WebLogic.WebRequestExecutor.ExecuteQuery(ITwitterQuery twitterQuery, ITwitterClientHandler handler)
   at Tweetinvi.WebLogic.TwitterRequestHandler.ExecuteQuery(String queryURL, HttpMethod httpMethod, TwitterClientHandler handler, ITwitterCredentials credentials, HttpContent httpContent)
   at Tweetinvi.Credentials.AuthFactory.InitializeApplicationBearer(ITwitterCredentials credentials)
   at Tweetinvi.Auth.InitializeApplicationOnlyCredentials(ITwitterCredentials credentials, Boolean force)
   at BirdsiteLive.Twitter.Tools.TwitterAuthenticationInitializer.InitTwitterCredentials()

This was surprising, as it has log level fail. So I changed the log level back to the default one, restarted, and tried again.
I got another exception, but a different one:

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.Net.Http.HttpRequestException: Resource temporarily unavailable
 ---> System.Net.Sockets.SocketException (11): Resource temporarily unavailable
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at BirdsiteLive.Domain.ActivityPubService.GetUser(String objectId) in /src/BirdsiteLive.Domain/ActivityPubService.cs:line 72
   at BirdsiteLive.Domain.UserService.ValidateSignature(String actor, String rawSig, String method, String path, String queryString, Dictionary`2 requestHeaders, String body) in /src/BirdsiteLive.Domain/UserService.cs:line 326
   at BirdsiteLive.Domain.UserService.FollowRequestedAsync(String signature, String method, String path, String queryString, Dictionary`2 requestHeaders, ActivityFollow activity, String body) in /src/BirdsiteLive.Domain/UserService.cs:line 144
   at BirdsiteLive.Controllers.UsersController.Inbox() in /src/BirdsiteLive/Controllers/UsersController.cs:line 202
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)

After that, I could never reproduce this. I've increase my log level to Trace, sent out some follow requests, and can't see any more errors. I think we can ignore those errors as one-time oddities (maybe of the Twitter API).

The additional trce log entries look fine to me, they are just the HTTP request headers.


Does other instances of BSL works properly with the account you're testing this?

Good idea. I found https://birdsites.wilde.cloud/ and had to try several, but eventually found one BSL instance where it worked. A follow request from my chaos.social account to @tagesschau@beta.mstdn.cf seems to have worked, at least @tagesschau@beta.mstdn.cf is listed in the "following" list of my account and searching for the account again shows an "unfollow" button (in contrast to my own instance, where the accounts I try to follow are not listed under "following" and searching for them again shows the "awaiting approval" icon).

So there has to be something wrong with my own BSL instance…

Update on my experiments with the beta.mstdn.cf instance: my "seems to be working" assumption was probably wrong. Since I have followed @tagesschau@beta.mstdn.cf from my chaos.social accounts, the original Twitter @tagesschau has published tweets, but I don't see them in my chaos.social timeline. Going to the account page on chaos.social also shows no posts:

image

So I also tried with my second account on layer8.space, and here I got stuck in the same "waiting approval" when I try to follow the account as with my own BSL instance:

image

Well, I guess there is no more need to put any effort into this… (#189 💸💀)

I have the exact same behaviour after a migration to another mastodon instance.
Even stranger, half of my migration worked (~300) but others are stuck in "waiting for approvals"

If you (re)followed a lot of users quickly, maybe you hit some API limitation, retry some accounts one by one to see if it solve this issue.

@yogan if you're interested to dig a bit more, I could add more traces in the critical parts to see what's going on.

Sure, why not. Let me know when you have a version available and I'll provide some trace output.

Was there ever a fix for this?

I need to add more logs to get a better view of the issue.

Do you have experienced the same issue? What instance are you using?