# healthcheck-payload — Agent usage Configure a coding agent for @nexload-sdk/healthcheck-payload. **Topic:** agents **Package:** `@nexload-sdk/healthcheck-payload` v3.0.1 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/healthcheck/payload/agents/ ## Install matching skills Install the skills whose triggers match the task. ### healthcheck-payload [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/healthcheck/payload/SKILL.md) ```text Use when integrating or reviewing @nexload-sdk/healthcheck-payload for Payload CMS dependency readiness, including the deterministic payload.find query contract, small limit and zero depth, optional where filters, expectedMinDocuments and empty-collection semantics, timeout normalization, readiness criticality, failure privacy, and adapter tests. ``` ```bash npx skills add gecut/nexload-sdk --skill healthcheck-payload ``` ## Project AGENTS.md ```markdown For @nexload-sdk/healthcheck-payload, load healthcheck-payload when its trigger matches. Read the package bundle and check public exports against the installed version before editing. ``` ## Package context [Scoped Markdown bundle](/nexload-sdk/packages/healthcheck/payload/llms.txt). ## Prompts ```text Check that Payload can read a collection. Use @nexload-sdk/healthcheck-payload and healthcheck-payload. Inspect the installed version and show a minimal typed example for my project. ``` ```text Review my @nexload-sdk/healthcheck-payload integration against the optimization page. Identify the relevant source for each finding and one test for the highest-risk behavior. ``` --- # API Reference & Compatibility Public API symbol reference and compatibility matrix for Healthcheck Payload. **Topic:** api **Package:** `@nexload-sdk/healthcheck-payload` v3.0.1 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/healthcheck/payload/api/ The complete public API symbol inventory is generated automatically from package source exports: ## Functions ### `payloadHealthCheck` ```ts payloadHealthCheck(payload: PayloadLike, options: PayloadHealthCheckOptions) => HealthCheckDefinition<"payload"> ``` **Exported from:** `@nexload-sdk/healthcheck-payload` Public function exported by @nexload-sdk/healthcheck-payload. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/healthcheck/payload/src/index.ts#L34) ## Interfaces ### `PayloadHealthCheckOptions` ```ts interface PayloadHealthCheckOptions { collection: string limit?: number timeoutMs?: number where?: Record depth?: number expectedMinDocuments?: number scopes?: readonly HealthScope[] } ``` **Exported from:** `@nexload-sdk/healthcheck-payload` Public interface exported by @nexload-sdk/healthcheck-payload. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/healthcheck/payload/src/index.ts#L11) *** ## Runtime Compatibility Matrix | Runtime / Engine | Version Requirement | Verification Status | |---|---|---| | **Node.js** | `>=20.9.0` | Verified on Node 20 & 22 | | **Payload CMS** | `>=3.85.0 <4.0.0` | Verified on Payload 3.86.0 | | **Module Format** | ESM only | Native ECMAScript Modules | | **Side Effects** | `false` | Fully tree-shakeable | --- # Production Guides & Recipes Probing Payload collections, database latency, lightweight health queries, and troubleshooting. **Topic:** guides **Package:** `@nexload-sdk/healthcheck-payload` v3.0.1 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/healthcheck/payload/guides/ ## Lightweight Readiness Probing To minimize database load during frequent health checks (e.g. every 5-10 seconds by Kubernetes): ```ts import { payloadHealthCheck } from "@nexload-sdk/healthcheck-payload"; const check = payloadHealthCheck(payload, { collection: "users", // Excluded from liveness probe: scopes: ["readiness"], timeoutMs: 3000, }); ``` The check requests zero population depth (`depth: 0`) and limits results to 1 document, ensuring minimal memory and database CPU utilization. *** ## Troubleshooting & Common Pitfalls ### 1. `PAYLOAD_QUERY_FAILED` Indicates that the underlying database connection timed out or rejected the query. Check database pool exhaustion, connection string validity, or network partitions. ### 2. Readiness Probe Is Slow (>1 second) Ensure the checked collection has an index and does not execute heavy `afterRead` hooks. If needed, create a dedicated minimal `_health` collection with a single static document. ### 3. Never Assign Payload Database Check to Liveness If the database goes down, liveness failure will cause continuous pod restarts. Always assign database checks to `scopes: ["readiness"]`. --- # Overview & Quick Start Verify Payload CMS database connectivity, collection accessibility, and initialization state. **Topic:** overview **Package:** `@nexload-sdk/healthcheck-payload` v3.0.1 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/healthcheck/payload/ **Package:** `@nexload-sdk/healthcheck-payload` **Workspace version:** `3.0.1` Payload CMS health checks for @nexload-sdk/healthcheck. [npm](https://www.npmjs.com/package/@nexload-sdk/healthcheck-payload) · [Source](https://github.com/gecut/nexload-sdk/tree/main/packages/healthcheck/payload) `@nexload-sdk/healthcheck-payload` connects `@nexload-sdk/healthcheck` to Payload CMS 3 instance state, verifying database connectivity, adapter health, and collection availability. *** ## 10-Second Code Snippet ```ts import { createHealthManager } from "@nexload-sdk/healthcheck"; import { payloadHealthCheck } from "@nexload-sdk/healthcheck-payload"; import config from "@payload-config"; import { getPayload } from "payload"; const payload = await getPayload({ config }); export const health = createHealthManager({ service: { name: "payload-cms" }, checks: [ payloadHealthCheck(payload, { collection: "users", expectedMinDocuments: 1, }), ], }); ``` *** ## What You Get * **Database Connectivity Verification**: Executes lightweight count queries via Payload Local API to confirm database accessibility. * **Boot Readiness Check**: Guarantees that Payload has finished compiling collections, globals, and plugins before Kubernetes directs traffic. * **Zero Raw SQL/Mongo Dependency**: Interacts solely through the authoritative Payload Local API. *** ## Installation & Requirements ```bash pnpm add @nexload-sdk/healthcheck-payload @nexload-sdk/healthcheck payload ``` Requires Payload CMS `>=3.85.0 <4.0.0` and Node.js `>=20.9.0`. *** ## Next Steps * Explore [Production Guides & Queries](./guides/) for collection verification, timeout tuning, and troubleshooting. * Check the [API Reference & Signatures](./api/) for check configuration options. ## Next steps [Optimization](./optimization/) [Agent usage](./agents/) --- # healthcheck-payload — Optimization Production choices for @nexload-sdk/healthcheck-payload. **Topic:** optimization **Package:** `@nexload-sdk/healthcheck-payload` v3.0.1 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/healthcheck/payload/optimization/ ## Bound readiness query cost Choose a small collection, use depth zero and supply a narrow where clause for frequent polls. ## Interpret probe failures The Payload query check is critical for readiness and noncritical for diagnostics. A failed query reports PAYLOAD\_QUERY\_FAILED. ## Keep the default query small The check defaults to `limit: 1`, `depth: 0`, and readiness. Frequent heavy queries can overload the database. ## Decide whether an empty collection is unhealthy Set `expectedMinDocuments` only when an empty collection represents an operational failure, such as missing required seed configuration. ## Sources [Package guidance](https://github.com/gecut/nexload-sdk/blob/main/packages/healthcheck/payload/README.md) · [Implementation](https://github.com/gecut/nexload-sdk/blob/main/packages/healthcheck/payload/src/index.ts). · [Matching skill](https://github.com/gecut/nexload-sdk/blob/main/skills/healthcheck/payload/SKILL.md).