New React-based apps: no way to send per-request custom headers from a backend function to a GraphQL resource?

Hi all :waving_hand: running into what looks like a platform gap in React-based apps and want to confirm whether there's a supported path before building a workaround.

Setup: I have a GraphQL resource backing a mutation that requires a per-request header — something like an acting-user ID, used for audit/attribution on a staff-only action. This value changes on every call, so it can't just be a static resource-level header.

What works: In a classic Retool app, I have a query with the header bound directly in the Headers UI field (e.g. x-header-name: {{ some_value }}). Triggering that query from the app works fine — the header reaches the server and the request succeeds.

What doesn't work: In a backend function called from a React-based app, I'm calling the generated GraphQL resource wrapper like:

const result = await myGraphqlResource(query, variables)

There's no parameter here for per-call headers. I tried casting it to accept a third options.headers argument, but confirmed via the request/response debug output that the header never actually reaches the wire — the cast just tells TypeScript to accept an extra argument, it doesn't change what the underlying generated function does at runtime. A JS function silently ignores call-site arguments it doesn't declare.

Question: Is there a supported way to send a dynamic, per-request header on a GraphQL resource call made from backend function / workflow code in a React-based app?

Thanks :folded_hands:

1 Like

UPDATE: This is slated to be fixed in version 4.27.0. :+1:


Thanks for reaching out, @TobiasOhlsson! It looks like we're working on this right now. :slightly_smiling_face: I'll give you an update here as soon as there is news to share!