@bugmail-js/core 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -0
- package/README.md +4 -3
- package/bugmail-core-client.js +4 -4
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ const client = new BugMailCoreClient({
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
await client.captureException(new Error('Test error'), {
|
|
32
|
-
headers: { '
|
|
32
|
+
headers: { 'x-bugmail-api-key': 'YOUR_PROJECT_API_KEY' },
|
|
33
33
|
payload: {
|
|
34
34
|
error: { name: 'Error', message: 'Test error', stack: '...' },
|
|
35
35
|
context: { url: '/test', environment: 'development' }
|
|
@@ -47,7 +47,7 @@ API reference (important parts)
|
|
|
47
47
|
- `captureException(error, context)`
|
|
48
48
|
- `error` — Error object or any serializable value
|
|
49
49
|
- `context` — optional object: `{ headers, payload, user, breadcrumbs }`
|
|
50
|
-
- Include `headers: { '
|
|
50
|
+
- Include `headers: { 'x-bugmail-api-key': '<YOUR_PROJECT_API_KEY>' }`
|
|
51
51
|
|
|
52
52
|
- `BreadcrumbTracker`
|
|
53
53
|
- `new BreadcrumbTracker({ maxBreadcrumbs })`
|
|
@@ -67,7 +67,8 @@ Integration notes
|
|
|
67
67
|
Backend integration & headers
|
|
68
68
|
|
|
69
69
|
- Ingestion endpoint: `POST {baseUrl}/api/sdk/v1/errors`
|
|
70
|
-
- Auth header: `x-bugmail-api-key: <YOUR_PROJECT_API_KEY>`
|
|
70
|
+
- Auth header: `x-bugmail-api-key: <YOUR_PROJECT_API_KEY>`
|
|
71
|
+
- Note: HTTP header names are case-insensitive; use the canonical lowercase form above for consistency.
|
|
71
72
|
- Typical payload shape:
|
|
72
73
|
|
|
73
74
|
```
|
package/bugmail-core-client.js
CHANGED
|
@@ -40,10 +40,10 @@ export class BugMailCoreClient {
|
|
|
40
40
|
if (!fetchFn) {
|
|
41
41
|
// In Node environments where fetch is not global, try dynamic import at runtime only
|
|
42
42
|
try {
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
//
|
|
43
|
+
// Check if we're actually in Node.js (not a browser with process polyfill)
|
|
44
|
+
// typeof window === 'undefined' is a reliable check for Node vs Browser
|
|
45
|
+
if (typeof window === 'undefined' && typeof process !== 'undefined' && process.versions && process.versions.node) {
|
|
46
|
+
// Only import node-fetch in actual Node.js environments
|
|
47
47
|
const nodeFetchName = 'node' + '-fetch';
|
|
48
48
|
fetchFn = (await import(nodeFetchName)).default;
|
|
49
49
|
} else {
|