> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/unified-api/debugging-faq.md).

# Troubleshooting

Find out why data events are not arriving for a user, and check the account, the provider sync and the mobile SDK setup.

When an end user reports missing data, work through the common causes on this page: the wrong account, data that has not synced to the provider's cloud, and known mobile SDK issues.

## Common reasons for missing data

Terra sends data automatically as soon as it is available on a data source's cloud. Here are a few potential reasons why you're not receiving Data Events:

1. If the user has connected to the wrong account.
2. If the wearable hasn't synced to the respective app on the end user's phone, or if the app has not synced to the cloud, Terra will be unable to retrieve that data.
3. If you have not completed additional destination configurations (e.g. to [integrations requiring dedicated credentials](https://docs.tryterra.co/unified-api/dedicated-data-source-api-keys.md)).
4. If your Destination is incorrectly configured. If this is the case, you can see 400 or 500 errors in the [Event log](https://dashboard.tryterra.co/dashboard/events) in your Terra dashboard.

## First things to try

* Wait a bit longer to rule out regular data delays from the data sources.
* Try to force a sync (using a "pull down to sync" feature or equivalent available in most apps).
* To verify the data has synced to the respective cloud, have the user open the web dashboard for their device in a browser and check the data is present.
* Submit a support ticket via your Terra dashboard if you are unsure.

{% prompt description="Triage a user with no data arriving" icon="terminal" openInAIProviders="true" defaultExpanded="full" %}

```markdown
No data is arriving for user 8f2a1c. Check whether the connection is active, whether any deliveries failed, and what the last event Terra sent was.

Use the Terra CLI: brew install tryterra/tap/terra, or npm install -g @tryterra/cli, then terra login. Run terra docs ask --question "<question>" for anything you need from the Terra docs, and terra <command> --help for usage.
```

{% endprompt %}

## Check the user connected the right account

Some users log in with the wrong account, and this happens more often than you'd think. In order to verify the account that they're using matches with the Terra user ID that they've generated, you may follow the following procedure for the integrations below.

### Get the provider's user ID

Terra always provides a `user_id` for each connection. To get the user ID that the provider (e.g. Garmin, Fitbit etc) uses, you can use the [https://docs.tryterra.co/reference/health-and-fitness-api/athlete](https://docs.tryterra.co/reference/health-and-fitness-api/athlete "mention") endpoint in order to retrieve that, which will be under the field `provider_user_id`. Once you have obtained that, follow the guidelines below for each provider.

### Fitbit

Launch your Fitbit app (make sure you're using the latest Fitbit app version), click your Fitbit avatar in the top left corner, then click your Fitbit display name to view your profile. Then Click "Personal" and go to the next page, your Fitbit User ID is located at the bottom.

![](https://files.readme.io/369b62f-image.png)

Check to make sure your user's Fitbit user ID matches the one retrieved by the [https://docs.tryterra.co/reference/health-and-fitness-api/athlete](https://docs.tryterra.co/reference/health-and-fitness-api/athlete "mention") endpoint

### MyFitnessPal

Using the `provider_user_id` obtained above, navigate to [https://www.myfitnesspal.com/food/diary/{provider\_user\_id}](https://www.myfitnesspal.com/food/diary/%7Bprovider_user_id%7D) .

**Invalid username.** Seeing a page like this:

![](https://files.readme.io/b2e0cc6-image.png)

indicates that the username entered by the end user is invalid. In the case above, the user accidentally entered **their email** instead of **their username**. Have them log in once more, following the "how-to" guide presented in the login screen

**Disabled diary sharing.** The page below:

![](https://files.readme.io/9e78b18-image.png)

Indicates the user failed to enable diary sharing/disabled it since they authenticated through Terra. In order to remediate this, have the user re-enable diary sharing with the same password used during initial authentication, or have them re-authenticate after having enabled diary sharing as per the "how-to" guide in the login screen

## Check the data synced from the device

In those cases the first step is always to ensure that the data is showing up in the partner app (e.g. Garmin Connect, Fitbit, etc..).

Next would be to check if the data is correctly synchronized with the partner cloud, by using their web portal.

### Garmin

Ensure that the data is showing up in [the Garmin connect web dashboard](https://connect.garmin.com/modern/). If not, then pull down from the top in the Garmin connect mobile app, and hit the circle arrow until everything refreshes. If the data shows up in the web dashboard for Garmin Connect, but not through the API after 1-2 minutes, please contact support.

![](https://files.readme.io/3efde45-ezgif.com-optimize.gif)

### Apple Health

The most likely cause is background updates not running. To check, request a backfill for the user in your Terra dashboard: open [Users](https://dashboard.tryterra.co/dashboard/users), select the user, and choose **Backfill** under **Get data**. The device uploads the window the next time the SDK runs.

If data does come through, this means that background delivery is not operating as expected. To Troubleshoot, follow the steps below.

**Battery saving mode is on.** Have the user go to Settings > Battery, and make sure "Low Power Mode" is turned **OFF**

**Background app refresh is turned off for your app.** Have the user visit Settings > General > Background App Refresh, and verify that your app is toggled on.

![](https://files.readme.io/27bfad6-RPReplay_Final1719410146-ezgif.com-optimize.gif)

### Google Fit

Go inside the Google Fit app, and ensure that your data is up to date on the display. Thereafter, pull down from the top of the screen to synchronize with the cloud. Please note that even after that, there can be some delay for Google to make the data available through their API. You should be able to see that data after at most 30-60 minutes in most cases.

![](https://files.readme.io/28c7b76-RPReplay_Final1719407216-ezgif.com-optimize.gif)

**On iOS**, ensure background app refresh is turned on for Google Fit

![](https://files.readme.io/27bfad6-RPReplay_Final1719410146-ezgif.com-optimize.gif)

## Mobile SDK known issues

### Health Connect

{% hint style="warning" %}
This section applies when you read Samsung Health or other apps' data **through** Health Connect: `Source.HEALTH` in the [Android SDK](https://docs.tryterra.co/mobile-sdks/android-sdk-2.md), or `'health'` on Android in the [React Native SDK](https://docs.tryterra.co/mobile-sdks/react-native-sdk-2.md). If you read Samsung Health directly (`Source.SAMSUNG_HEALTH` or `'samsungHealth'`), see the next section.
{% endhint %}

Health Connect is Google's on-device health store. The SDK can only read what other apps have written into it.

{% hint style="danger" %}
**Health Connect known issues**

Apps sometimes fail to write into Health Connect because of bugs in Health Connect itself. For example, Samsung Health may not send **steps** into Health Connect. In other cases Health Connect data cannot be read at all, so little or no data syncs.

Before release, submit the Health Connect declaration in the Google Play Console, listing the data types your app reads. See [Apply for Health Connect access](https://docs.tryterra.co/mobile-sdks/android-sdk-2.md#configure-health-permissions).
{% endhint %}

### Samsung Health direct access

This section applies when you read Samsung Health directly with the `terra-android-samsung` add-on: `Source.SAMSUNG_HEALTH` in the Android SDK, or `'samsungHealth'` in the React Native SDK. See [Samsung Health](https://docs.tryterra.co/mobile-sdks/samsung-health.md) for setup.

{% hint style="info" %}
**Samsung Health permission sheet not appearing**

If the permission sheet does not appear, `permissions.request` throws `TerraError.HealthDataUnavailable` with the reason (in React Native, it rejects with `health_data_unavailable`). Call `terra.availability(Source.SAMSUNG_HEALTH)`, or `terra.availability('samsungHealth')` in React Native, to read the reason without a connection. React Native returns each reason as a `kind` in camelCase, such as `providerAppMissing`. The reasons are:

* `ModuleMissing`: the `terra-android-samsung` add-on is not in the app. In React Native, set `terraSamsungHealth=true` in `android/gradle.properties`.
* `ProviderAppMissing`: Samsung Health is not installed, is disabled, or is not set up on the device.
* `ProviderAppTooOld`: Samsung Health needs an update.
* `PartnerPolicyMissing`: Samsung has not approved your app for these data types. Until it does, turn on Samsung Health's developer mode on test devices: in Samsung Health, open **Settings > About Samsung Health** and tap the version number repeatedly.
  {% endhint %}

{% hint style="warning" %}
**App crashes in release builds with the 1.x SDK**

This applies to the 1.x SDKs only (`terra-android` 1.x, `terra-react` and `terra-flutter`). If your app works in debug but crashes when it uses Samsung Health in a release build, R8 has stripped Samsung SDK classes and you get `ClassNotFoundException` at runtime. Add this rule to `proguard-rules.pro`:

```proguard
-keep class com.samsung.android.** { *; }
```

With 2.x, Samsung's Health Data SDK 1.1.0 carries its own keep rules, so no rule is needed.
{% endhint %}

## Next steps

* [Event delivery](https://docs.tryterra.co/destinations/events.md): see how Terra delivers events and retries failed attempts.
* [Historical data requests](https://docs.tryterra.co/unified-api/requesting-historical-data.md): backfill the gap once the cause is fixed.
* [Mobile SDKs](https://docs.tryterra.co/mobile-sdks/mobile-only-sources.md): set up Apple Health, Samsung Health and Health Connect.
