Skip to content

createJsonQuery returns null result in React Native 0.81 (New Architecture) while network request succeeds #571

@IZZAGOLD

Description

@IZZAGOLD

Description:
After upgrading to React Native 0.81.5 (which includes React 19 and uses the new C++ Networking stack via JSI), all queries created via createJsonQuery return null as the result, even though the underlying network request is successful (Status 200) and contains a valid JSON body.

Environment:
React Native: 0.81.5

React: 19.1.0

Farfetched: 0.14.1

Architecture: New Architecture (RCTNewArchEnabled=true)

Platform: iOS (Simulator/Device)

Steps to Reproduce:
Create a query using createJsonQuery.

Execute the query against a GraphQL/JSON endpoint.

Observe the result in contract.isData or mapData.

Observed Behavior:
The network request is visible in Reactotron or Flipper with Status 200 and a correct JSON body.

Inside createJsonQuery, the raw result passed to contract.isData is null.

The validate function receives null.

Error logs show: Response was considered as invalid against a given contract.

Root Cause Analysis:
It appears that Farfetched's internal response parsing (specifically handling of response.json()) fails to consume the native ReadableStream provided by the new C++ networking layer in RN 0.81.

Even when using custom converters like:

TypeScript

converters: [
{
isContentType: (type) => type.includes('json'),
parse: (res) => res.text().then((text) => JSON.parse(text)),
},
]
The result remains null, suggesting the response body is either pre-consumed or incorrectly handled by the internal fetch wrapper in the new architecture.

Attempted Fixes:
Upgraded web-streams-polyfill to v4.

Removed all legacy fetch/blob polyfills (react-native-polyfill-globals, etc.).

Set credentials: 'include' and 'omit'.

Explicitly set Accept-Encoding: identity to bypass GZIP issues.

Expected Behavior:
The query should correctly parse the JSON body from the native fetch response and pass it to the contract/mapData functions.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions