bluesky-social / atproto

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

agent.post : got 400 InvalidRequest - miss 400 payload to obtain 400 details #2542

Open boly38 opened 3 months ago

boly38 commented 3 months ago

Context

when using bluesky agent to send a replyTo, I got a 400 as result (boly38/botEnSky#36)

In Node.js : extract of the call

import {BskyAgent} from '@atproto/api'
(...)
agent.post(replyPost)
                .then(postReplyResponse => {
                    resolve(postReplyResponse);
                })
                .catch(err => {
                    console.log("POST ERR" + JSON.stringify(err))
                    reject(err);
                })

The result error is

POST ERR{"status":400,"error":"InvalidRequest","success":false,"headers":{"access-control-allow-origin":"*","content-length":"132","content-type":"application/json; charset=utf-8","date":"Sun, 02 Jun 2024 12:38:55 GMT","etag":"W/\"84-8F/JCt3SgfypR1VYxro03Yu5m2I\"","keep-alive":"timeout=90","ratelimit-limit":"5000","ratelimit-policy":"5000;w=3600","ratelimit-remaining":"4982","ratelimit-reset":"1717334685","strict-transport-security":"max-age=63072000","vary":"Accept-Encoding","x-powered-by":"Express"}}

Is your feature request related to a problem? Please describe.

Following context use, I would expect to get 400 details to understand where I'm wrong in the payload I send to agent.post.

Out-of-error, I'm unable to get more than 400 + InvalidRequest But It seems that bluesky backend provide more error details in payload ("content-length":"132",)

Describe the solution you'd like

I would like 400 details in addition to error summary in order to help troubleshooting

Describe alternatives you've considered

iterate by resending payload with some part added/removed.. but its tedious. I got 400 when trying to add facet to my replyTo message (I was using wrong facet model structure..)

Additional context