bluesky-social / atproto

Social networking technology created by Bluesky
Other
6.13k stars 432 forks source link

PUT Profile Server Region #2782

Open DanielHe4rt opened 1 week ago

DanielHe4rt commented 1 week ago

Describe the bug

While I was trying to use the AT Protocol I got some 405 using the https://public.api.bsky.app/xrpc/com.atproto.repo.putRecord endpoint and it only worked after an inspection at the User API by getting the closest server (I guess).

This public URL probably isn't routing for the right server? In any case would be good to point them to the closest datacenter/server.

To Reproduce

Steps to reproduce the behavior:

  1. Follow the PutRecord API
  2. Send an Update Request using the default endpoint

Result:

405 request

Expected behavior

200 request

Details

Additional context

    public function putProfile(SessionEntity $session, ProfileEntity $profile)
    {
        // $url = 'https://public.api.bsky.app/xrpc/com.atproto.repo.putRecord'; doesn't worked
        $url = 'https://blewit.us-west.host.bsky.network/xrpc/com.atproto.repo.putRecord'; worked
        $data = [
            'repo' => $session->getDid(),
            'collection' => 'app.bsky.actor.profile',
            'rkey' => 'self',
            'record' => $profile->getValue(),
            'swapRecord' => $profile->getCid(),
        ];

        $response = Http::withToken($session->getAccessJwt())
            ->post($url, $data);

        return $response->json();
    }

PS: quite confusing a PUT labeled request being a POST request :p

DanielHe4rt commented 1 week ago

Had the same issue in my main account (this tested above is an test account that I uses at my livestreams).

In my main account, neither these two pointed above worked so I had to change the endpoint to:

https://lionsmane.us-east.host.bsky.network/xrpc/com.atproto.repo.putRecord

I'm guessing that this public API url should be a proxy to the user authenticated region, right?