GET /api/oauth2/v2/identity?include=memberships.currently_entitled_tiers returns 504 Gateway
Timeout for users with many memberships. The timeout happens server-side (~10s) regardless of pagination (page[count]=10), field selection, or other includes combined with it.
memberships.campaign.tiers fails the same way.
Reproduction (requires identity identity.memberships token for a user with about 400+ memberships):
// Requires: access token with "identity identity.memberships" scope
const TOKEN = process.env.PATREON_ACCESS_TOKEN;
const BASE = "https://www.patreon.com/api/oauth2/v2";
async function call(label, url) {
const res = await fetch(url, { headers: { Authorization: `Bearer ${TOKEN}` } });
console.log(`[${label}] -> ${res.status}`);
}
// Works
await call("memberships only",
`${BASE}/identity?include=memberships&fields%5Bmember%5D=patron_status`);
// 504 - adding currently_entitled_tiers
await call("memberships + currently_entitled_tiers",
`${BASE}/identity?include=memberships,memberships.currently_entitled_tiers`);
// 504 - same as WP plugin's fetch_user() pattern
await call("WP plugin exact pattern",
`${BASE}/identity?include=memberships.currently_entitled_tiers,memberships.campaign` +
`&fields%5Bmember%5D=currently_entitled_amount_cents,patron_status,pledge_relationship_start`
);