Skip to content

v14: HKQuantityTypeIdentifierBloodKetones regressed — missing from enum (was fixed in v13 via #311) #347

@gvilomar

Description

@gvilomar

Summary

HKQuantityTypeIdentifierBloodKetones is missing from the v14 QuantityTypeIdentifier enum. This is a regression of #311, which was fixed and shipped in v13 — the identifier is now gone again in v14.

Reproduction

import { queryQuantitySamples } from '@kingstinct/react-native-healthkit';

await queryQuantitySamples('HKQuantityTypeIdentifierBloodKetones', {
  limit: -1,
  filter: { date: { startDate: new Date(Date.now() - 86400000), endDate: new Date() } },
  unit: 'mmol/L',
});

Expected behavior

The call returns an array of QuantitySample (or [] if there are no samples), the same as any other blood-related identifier (HKQuantityTypeIdentifierBloodGlucose, HKQuantityTypeIdentifierBloodPressureSystolic, etc.).

Actual behavior

The call throws synchronously at the JS↔native bridge:

QuantityTypeModule.queryQuantitySamples(...): Cannot convert
"HKQuantityTypeIdentifierBloodKetones" to enum QuantityTypeIdentifier
- invalid value!

Severity — why this is high-impact, not just a missing identifier

The throw happens synchronously during the bridge's enum validation, before the returned Promise can construct. That means the standard error pattern fails:

// This .catch never runs — the throw escapes the Promise wrapper.
queryQuantitySamples('HKQuantityTypeIdentifierBloodKetones', ...).catch(() => []);

The exception bubbles up through any Promise.all it's bundled in, silently killing the entire batch read. In our codebase, BloodKetones is one of ~25 identifiers we read in parallel (vitals, body, sleep, activity, dietary). With BloodKetones in the batch, none of them came back — HRV, RHR, SpO2, weight, glucose, BP all silently failed for every backfill day. Took us several hours to diagnose because each individual q().catch(...) looked correct.

In v13 this was masked (the identifier returned empty samples silently — annoying but not destructive). In v14 the bridge is stricter and the throw escapes.

Affected files

Suggestion: an end-to-end test that calls queryQuantitySamples with each identifier and asserts no sync throw might catch future regressions of this category.

Apple HealthKit reference

Workaround

For anyone who hits this before it's fixed: remove BloodKetones from your read list entirely. Casting won't help — the enum validation is at the native bridge layer, not the TypeScript layer. Manual entry from a check-in form is the only viable path until the identifier is restored.

Environment

  • Library version: 14.0.0
  • React Native: 0.81
  • Expo SDK: 55
  • iOS: 18.x

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions