> For the complete documentation index, see [llms.txt](https://docs.verygoodsecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-show/react-native-sdk/debugging.md).

# Debugging

### Logging

The SDK logger is disabled by default.

```ts
import { VGSLogger, VGSShowError } from "@vgs/show-react-native";

VGSLogger.shared.configuration = {
  level: "none",
  isNetworkDebugEnabled: false,
  isExtensiveDebugEnabled: false
};
```

Log levels:

| Level       | Description                                |
| ----------- | ------------------------------------------ |
| `"info"`    | Records informational and warning entries. |
| `"warning"` | Records warnings only.                     |
| `"none"`    | Records no entries. This is the default.   |

Diagnostic logging should stay disabled in production. Network debug logging can include response bodies and must be treated as sensitive.

Development-only example:

```ts
if (__DEV__) {
  VGSLogger.shared.configuration = {
    level: "warning",
    isNetworkDebugEnabled: false,
    isExtensiveDebugEnabled: false
  };
}
```

Do not log request payloads, response bodies, custom header values, tokens, authorization values, revealed text, media base64, hashes, lengths, or customer identifiers.

### Access Logger

For route-level investigation, use the VGS Dashboard Access Logger. It can help verify whether a reveal request reached VGS, which route matched, and whether the upstream response shape matches your component `contentPath` values.

### Error handling

SDK request failures and component reveal failures use `VGSShowError`.

```ts
try {
  await vgsShow.request({ path: "/post" });
} catch (error) {
  if (error instanceof VGSShowError) {
    setStatus(userMessageForShowError(error));
    return;
  }

  setStatus("Reveal failed.");
}
```

Use `type` or `code` for branching:

```ts
function userMessageForShowError(error: VGSShowError): string {
  switch (error.type) {
    case "fieldNotFound":
      return "Requested data is unavailable.";
    case "invalidImageData":
    case "invalidPDFData":
    case "invalidBase64Data":
      return "Content cannot be displayed.";
    case "invalidConfigurationURL":
      return "Reveal configuration is invalid.";
    default:
      return "Reveal failed.";
  }
}
```

### Error codes

| Code   | Type                           | Description                                             |
| ------ | ------------------------------ | ------------------------------------------------------- |
| `1400` | `unexpectedResponseType`       | Response type or transport result is not supported.     |
| `1401` | `unexpectedResponseDataFormat` | Response data format is not supported.                  |
| `1402` | `responseIsInvalidJSON`        | Response body cannot be decoded to a JSON object.       |
| `1403` | `fieldNotFound`                | A component could not find or decode its `contentPath`. |
| `1404` | `invalidJSONPayload`           | Request payload is not a valid plain JSON object.       |
| `1405` | `invalidBase64Data`            | Media field is not valid base64.                        |
| `1406` | `invalidPDFData`               | PDF data cannot be rendered.                            |
| `1407` | `invalidImageData`             | Image data cannot be rendered.                          |
| `1480` | `invalidConfigurationURL`      | Vault environment or configuration URL is invalid.      |

### Common issues

| Symptom                                     | Likely cause                                                            | Fix                                                                        |
| ------------------------------------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| Component stays on placeholder              | `contentPath` is empty, missing, or points to the wrong JSON field.     | Compare the route response shape with each component path.                 |
| `request()` resolves but one field is empty | HTTP and JSON succeeded, but that component failed to decode its field. | Handle component error callbacks and validate response field types.        |
| `invalidBase64Data`                         | Image or PDF field is not strict base64.                                | Return base64 content at the configured path.                              |
| `invalidPDFData`                            | Base64 decoded but is not renderable PDF data.                          | Validate the PDF server-side and increase request timeout for large files. |
| `invalidImageData`                          | Base64 decoded but the image cannot render.                             | Return renderable image data supported by the native renderer.             |
| Web build fails                             | The SDK supports iOS and Android only.                                  | Keep SDK imports out of web entrypoints.                                   |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verygoodsecurity.com/vault/developer-tools/vgs-show/react-native-sdk/debugging.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
