~tsileo/microblog.pub#105: 
401 failures attempting to follow

On 3fc567861b97fbe08bc605eb9467db48099555ce I'm unable to follow this (or seemingly any) account: https://mastodon.social/@Sheril

It gives httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://mastodon.social/users/Sheril/inbox'

Here's a stack trace from trying to follow https://hachyderm.io/users/mitsuhiko:

2023-01-12 01:48:56.207 | INFO     | app.outgoing_activities:fetch_next_outgoing_activity:173 - 1 outgoing activities ready to process
2023-01-12 01:48:56.210 | INFO     | app.outgoing_activities:process_next_outgoing_activity:200 - recipient=https://hachyderm.io/users/mitsuhiko/inbox
2023-01-12 01:48:56.211 | INFO     | app.outgoing_activities:process_next_outgoing_activity:236 - payload={'@context': 'https://www.w3.org/ns/activitystreams', 'id': 'https://joshhansen.tech/o/2456e466e8ee4bd9b837b74583051930', 'type': 'Follow', 'actor': 'https://joshhansen.tech', 'object': 'https://hachyderm.io/users/mitsuhiko'}
2023-01-12 01:48:56.211 | INFO     | app.activitypub:post:394 - Posting https://hachyderm.io/users/mitsuhiko/inbox (payload={'@context': 'https://www.w3.org/ns/activitystreams', 'id': 'https://joshhansen.tech/o/2456e466e8ee4bd9b837b74583051930', 'type': 'Follow', 'actor': 'https://joshhansen.tech', 'object': 'https://hachyderm.io/users/mitsuhiko'})
2023-01-12 01:48:56.243 | INFO     | app.httpsig:auth_flow:318 - keyid=https://joshhansen.tech#main-key
2023-01-12 01:48:56.248 | DEBUG    | app.httpsig:auth_flow:346 - signed request sig_value='keyId="https://joshhansen.tech#main-key",algorithm="rsa-sha256",headers="(request-target) user-agent host date digest content-type",signature="T0UVQiYvoC6uKl3F6BUb8wXoKsXPfB9tNup/5Iw/Oa/HvkmrmQfF92b0nUPFGHYr6CvR60hLmFuR3nI6SSmmapmSVZ523x2qV7clNySU1tw6VzTogod855CAPCuZ12kGeO/0PHRMzWN4I/9O/g1k5QjK8fKrc2S0qdI5n1Q0f89sUCs6hhULs6U84Ap34xaEdZgxue8niUcvC9QFI5UVHa/E4QEouuXYQObISrXVw18B5X9unKRmd+wyOFyXHr9Y37Stnq9cDKu/uPa5C0QN2AffLgAqYVuAzkyepDfDj3CdAGLAFTD5kY2uNr84wJKmqsNQEbi7br5/Z9slmhB+WA=="'
2023-01-12 01:48:57.367 | ERROR    | app.outgoing_activities:process_next_outgoing_activity:240 - Failed
Traceback (most recent call last):

  File "/home/josh/.cache/pypoetry/virtualenvs/microblogpub-i71lNdgq-py3.10/bin/inv", line 8, in <module>
    sys.exit(program.run())
    │   │    │       └ <function Program.run at 0x7fe079373a30>
    │   │    └ <invoke.program.Program object at 0x7fe0799102b0>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/home/josh/.cache/pypoetry/virtualenvs/microblogpub-i71lNdgq-py3.10/lib/python3.10/site-packages/invoke/program.py", line 384, in run
    self.execute()
    │    └ <function Program.execute at 0x7fe079373d00>
    └ <invoke.program.Program object at 0x7fe0799102b0>
  File "/home/josh/.cache/pypoetry/virtualenvs/microblogpub-i71lNdgq-py3.10/lib/python3.10/site-packages/invoke/program.py", line 569, in execute
    executor.execute(*self.tasks)
    │        │        │    └ [<parser/Context 'process-outgoing-activities'>]
    │        │        └ <invoke.program.Program object at 0x7fe0799102b0>
    │        └ <function Executor.execute at 0x7fe079353520>
    └ <invoke.executor.Executor object at 0x7fe077ea1ae0>
  File "/home/josh/.cache/pypoetry/virtualenvs/microblogpub-i71lNdgq-py3.10/lib/python3.10/site-packages/invoke/executor.py", line 129, in execute
    result = call.task(*args, **call.kwargs)
             │    │     │       │    └ {}
             │    │     │       └ <Call 'process_outgoing_activities' (called as: 'process-outgoing-activities'), args: (), kwargs: {}>
             │    │     └ (<Context: <Config: {'run': {'asynchronous': False, 'disown': False, 'dry': False, 'echo': False, 'echo_stdin': None, 'encodi...
             │    └ <Task 'process_outgoing_activities'>
             └ <Call 'process_outgoing_activities' (called as: 'process-outgoing-activities'), args: (), kwargs: {}>
  File "/home/josh/.cache/pypoetry/virtualenvs/microblogpub-i71lNdgq-py3.10/lib/python3.10/site-packages/invoke/tasks.py", line 127, in __call__
    result = self.body(*args, **kwargs)
             │    │     │       └ {}
             │    │     └ (<Context: <Config: {'run': {'asynchronous': False, 'disown': False, 'dry': False, 'echo': False, 'echo_stdin': None, 'encodi...
             │    └ <function process_outgoing_activities at 0x7fe077e47ac0>
             └ <Task 'process_outgoing_activities'>

  File "/home/josh/joshhansen.tech/tasks.py", line 108, in process_outgoing_activities
    asyncio.run(loop())
    │       │   └ <function loop at 0x7fe07470fd90>
    │       └ <function run at 0x7fe0793a15a0>
    └ <module 'asyncio' from '/usr/lib/python3.10/asyncio/__init__.py'>

  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object loop at 0x7fe077e16110>
           │    └ <function BaseEventLoop.run_until_complete at 0x7fe078b22e60>
           └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/lib/python3.10/asyncio/base_events.py", line 633, in run_until_complete
    self.run_forever()
    │    └ <function BaseEventLoop.run_forever at 0x7fe078b22dd0>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/lib/python3.10/asyncio/base_events.py", line 600, in run_forever
    self._run_once()
    │    └ <function BaseEventLoop._run_once at 0x7fe078b28940>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1896, in _run_once
    handle._run()
    │      └ <function Handle._run at 0x7fe0792983a0>
    └ <Handle <TaskStepMethWrapper object at 0x7fe073b49c00>()>
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
    │    │            │    │           │    └ <member '_args' of 'Handle' objects>
    │    │            │    │           └ <Handle <TaskStepMethWrapper object at 0x7fe073b49c00>()>
    │    │            │    └ <member '_callback' of 'Handle' objects>
    │    │            └ <Handle <TaskStepMethWrapper object at 0x7fe073b49c00>()>
    │    └ <member '_context' of 'Handle' objects>
    └ <Handle <TaskStepMethWrapper object at 0x7fe073b49c00>()>

  File "/home/josh/joshhansen.tech/app/utils/workers.py", line 32, in _main_loop
    await self.process_message(db_session, next_message)
          │    │               │           └ <app.models.OutgoingActivity object at 0x7fe073b488e0>
          │    │               └ <sqlalchemy.orm.session.AsyncSession object at 0x7fe074785660>
          │    └ <function OutgoingActivityWorker.process_message at 0x7fe07470fe20>
          └ <app.outgoing_activities.OutgoingActivityWorker object at 0x7fe074785930>

  File "/home/josh/joshhansen.tech/app/outgoing_activities.py", line 278, in process_message
    await process_next_outgoing_activity(db_session, next_activity)
          │                              │           └ <app.models.OutgoingActivity object at 0x7fe073b488e0>
          │                              └ <sqlalchemy.orm.session.AsyncSession object at 0x7fe074785660>
          └ <function process_next_outgoing_activity at 0x7fe07470fd00>

> File "/home/josh/joshhansen.tech/app/outgoing_activities.py", line 238, in process_next_outgoing_activity
    resp = await ap.post(next_activity.recipient, payload)  # type: ignore
                 │  │    │             │          └ {'@context': 'https://www.w3.org/ns/activitystreams', 'id': 'https://joshhansen.tech/o/2456e466e8ee4bd9b837b74583051930', 'ty...
                 │  │    │             └ <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe07472af70>
                 │  │    └ <app.models.OutgoingActivity object at 0x7fe073b488e0>
                 │  └ <function post at 0x7fe075cae830>
                 └ <module 'app.activitypub' from '/home/josh/joshhansen.tech/app/activitypub.py'>

  File "/home/josh/joshhansen.tech/app/activitypub.py", line 407, in post
    resp.raise_for_status()
    │    └ <function Response.raise_for_status at 0x7fe078723760>
    └ <Response [401 Unauthorized]>

  File "/home/josh/.cache/pypoetry/virtualenvs/microblogpub-i71lNdgq-py3.10/lib/python3.10/site-packages/httpx/_models.py", line 736, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
          │               │                │                 └ <Response [401 Unauthorized]>
          │               │                └ <Request('POST', 'https://hachyderm.io/users/mitsuhiko/inbox')>
          │               └ "Client error '401 Unauthorized' for url 'https://hachyderm.io/users/mitsuhiko/inbox'\nFor more information check: https://ht...
          └ <class 'httpx.HTTPStatusError'>

httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://hachyderm.io/users/mitsuhiko/inbox'
For more information check: https://httpstatuses.com/401
Status
REPORTED
Submitter
~joshhansen
Assigned to
No-one
Submitted
18 days ago
Updated
13 days ago
Labels
No labels applied.

~joshhansen 13 days ago

Digging into this, it seems the text of the 401 error when I try to follow https://hachyderm.io/@joshhansen (for example) is: Unable to fetch key JSON at https://joshhansen.tech#main-key

Seems Mastodon on the other end is requesting the key at the wrong address?

My configuration checks out as OK, and the CSS is updated.

I did change my username early on. Could that be breaking attempts at federation now?

~joshhansen 13 days ago

Alright, this was due to a tweak on my instance that made / load the articles rather than the notes. Apparently this interferes with resolving the signing key. I backed out that change, and everything's happy now.

Register here or Log in to comment, or comment via email.