cloudeye-sdk
v0.2.0
Published
Report your app's errors to CloudEye — grouped, counted, and explained by AI next to your AWS metrics.
Maintainers
Readme
cloudeye-sdk
Report your app's errors to CloudEye — grouped, counted, and explained by AI right next to your AWS metrics, deploys and cost.
The SDK captures JavaScript errors, unhandled promise rejections and failed fetch() calls, batches them, and posts them to your CloudEye ingest endpoint. It is ~2 KB, has zero dependencies, and is built to never break or slow down your app: every path is wrapped, failures are silent, and payloads go as CORS simple requests (no preflight, no server CORS config).
Install
npm install cloudeye-sdkimport CloudEye from "cloudeye-sdk";
CloudEye.init({
key: "ce_pk_your_publishable_key", // CloudEye → Settings → API keys
environment: "prod", // your app's environment label
release: "1.4.2", // git SHA or version — maps errors to deploys
});Or as a script tag (no bundler):
<script src="cloudeye.iife.js"></script>
<script>CloudEye.init({ key: "ce_pk_…", environment: "prod" });</script>Errors appear in CloudEye under App errors, where each group has an AI Explain button that correlates it with your live AWS data.
Options
| Option | Default | What it does |
| --- | --- | --- |
| key | — (required) | Publishable API key (ce_pk_…). Safe to ship in client bundles — it can only report errors, never read anything. |
| endpoint | CloudEye cloud | Ingest URL. Point it at http://127.0.0.1:4630/api/ingest against a local CloudEye, or your staging host. |
| environment | "production" | Free-form environment label shown and filterable in CloudEye. |
| release | "" | Release/version identifier, so a spike lines up with the deploy that caused it. |
| sampleRate | 1 | Fraction of errors to report (0–1). |
| captureFetch | true | Also report fetch() network failures and 5xx responses. |
| beforeSend | — | (event) => event \| null. Inspect, scrub, or drop events before they are queued. |
Manual capture
try {
risky();
} catch (err) {
CloudEye.captureException(err, { orderId: "…" }); // second arg: small context object
}Keys: publishable vs secret
ce_pk_…publishable — ships inside web/mobile bundles. Ingest-only, forever.ce_sk_…secret — for your servers only; treat it like a password. Also accepted by the ingest API (send it asAuthorization: Bearer ce_sk_…from server-side code).
Both are created, listed (masked) and revoked in CloudEye → Settings → API keys. A key's full value is shown exactly once, at creation. Rotation = create a new key, deploy it, revoke the old one.
Privacy & safety notes
- The SDK sends: error name/message/stack, the page URL, your environment/release labels, the browser user-agent, and anything you pass in
meta/captureExceptioncontext. Nothing else — no cookies, no user identity, no request bodies. - Payload fields are hard-capped client-side and re-validated server-side.
- Duplicate errors are throttled client-side (one per 5 minutes per unique error) and rate-limited per key server-side.
- A revoked key makes the SDK go silent for the session — your app is never affected.
Publishing (maintainers)
cd sdk
npm install
npm publish --access public # prepublishOnly runs tests + build