Open aaronschachter opened 8 years ago
Interestingly, I'm not getting this issue when making the same request against Phoenix on my local so it might be hard to debug exactly what's going wrong with this on production.
It does return a whopping 115kb of JSON though, which seems pretty outrageous. I think a good solution would be to cap the count
parameter to a reasonable limit (say, 50?) and then have clients request additional pages of results when needed.
BUG
Current Behavior
200
response back but with invalid JSON data. In this example, our returned response breaks in the middle of a campaign'sreportback_info.copy
:https://northstar.dosomething.org/v1/signups?user=56eab76e469c6444628b60f2&count=150
Desired Behavior
Why This Matters
This is definitely an edge case for now, but may bite us as our users signup and reportback for multiple campaigns/runs as we focus on increasing impact. We're currently querying for 200 signups in iOS as a hack until we add paginated API requests when displaying a User's Profile.
I'd imagine (but haven't tested) that this is an issue across all Phoenix API endpoints, not just Signups. We could ballpark a max
count
to request, but in theory, if it's just truncating the response after some number of bytes, as @DFurnes wondered in #api Slack, we could inspect the size of our response before returning -- and instead return anerror
object.