this post was submitted on 25 Jul 2025
7 points (100.0% liked)

PieFed API & mobile app dev

81 readers
1 users here now

Announcements and discussions about the PieFed API - changes, improvements and general co-ordination between the frontend developers and the core of PieFed.

founded 2 weeks ago
MODERATORS
 

Hello! I am getting 400 errors when hitting the piefed.social. Hitting other piefed instances appear to work.

The exact error I get is:

{"code":400,"message":"{'my_user': {'instance_blocks': {0: {'site': ['Missing data for required field.']}}}}","status":"Bad Request"}

As an example I get this error when I make a GET request to https://piefed.social/api/alpha/site.

Note that I am making with request without an Authorization header.

Update

It seems that only alpha/site endpoint is broken. I can GET https://piefed.social/api/alpha/federated_instances just fine.

top 10 comments
sorted by: hot top controversial new old
[–] wjs018@piefed.wjs018.xyz 3 points 1 week ago* (last edited 1 week ago) (1 children)

Ok, I was able to reproduce this and made a PR for a fix. This issue only pops up when a user has instance blocks and works fine otherwise, which is why others in this thread (and myself when I was testing) aren't running into issues.

The root cause really is that I was creating schema for input and output validation to match the manually created swagger docs, but the output for instance_blocks was different than specified (and I marked it as a required field, likely from a copy/paste error). So, thanks for helping us as we are going through endpoints and making them self-documenting.

[–] idunnololz@lemmy.world 1 points 1 week ago
[–] rimu@piefed.social 2 points 1 week ago (1 children)

I've merged a fix, is it ok for you now?

[–] idunnololz@lemmy.world 1 points 1 week ago

Can confirm that this is now fixed. Thank you!

[–] idunnololz@lemmy.world 1 points 1 week ago (1 children)

By the way, I am using this endpoint (https://piefed.social/api/alpha/site) to determine if the server is running PieFed. If there is a better endpoint to use for this purpose please let me know.

[–] wjs018@piefed.wjs018.xyz 2 points 1 week ago

I think that is fine and don't see a problem with that. As for when this issue will get fixed, I merged a fix so other instances hopefully don't get it, but that won't make it onto piefed.social until the Kiwis wake up and @rimu@piefed.social is back online.

[–] INeedMana@piefed.zip 1 points 1 week ago (2 children)

Hm. I just clicked it in Firefox and got a response JSON. A good response

[–] idunnololz@lemmy.world 1 points 1 week ago

It might be a staged rollout? I think the bug is related to this commit (from 14 hours ago): https://codeberg.org/rimu/pyfedi/commit/a68902e5881677fefcfd707e415372f728866543

[–] INeedMana@piefed.zip 1 points 1 week ago (1 children)
[–] idunnololz@lemmy.world 1 points 1 week ago* (last edited 1 week ago)

Yeah I can curl it just fine. It's only 400ing in the app. I inspected the network request and nothing seems amiss. It was working yesterday and it's only broken on piefed.social.