securenow 6.0.0 → 6.0.2

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.
@@ -1,5 +1,39 @@
1
1
  # Changelog - Next.js Support
2
2
 
3
+ ## Version 6.0.1 (Logging hotfix)
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - **Fixed: `logger.emit()` silently dropped every log record in 6.0.0.**
8
+ `tracing.js` constructed the `LoggerProvider` with `{ processors: [new
9
+ BatchLogRecordProcessor(...)] }`, but that constructor option was only added
10
+ in `@opentelemetry/sdk-logs` 0.52 — the pinned 0.47.x silently ignores it,
11
+ leaving the provider with a `NoopLogRecordProcessor`. Every `logger.emit()`
12
+ (and every auto-captured `console.*`) was dropped, and `forceFlush()`
13
+ resolved with nothing to export. No HTTP POST ever reached `/v1/logs`.
14
+ Traces were unaffected (separate pipeline). Fixed by calling
15
+ `loggerProvider.addLogRecordProcessor(...)` after construction, matching the
16
+ 0.47.x API.
17
+
18
+ ### ✨ Improvements
19
+
20
+ - **`registerSecureNow()` (Next.js) now wires the OTLP logs pipeline.** In
21
+ 6.0.0, `securenow/nextjs` only set up traces — calling `registerSecureNow()`
22
+ with `SECURENOW_LOGGING_ENABLED=1` would log the "ENABLED" banner but emit
23
+ nothing. 6.0.1 creates a `LoggerProvider`, registers a
24
+ `BatchLogRecordProcessor(OTLPLogExporter)`, publishes it via
25
+ `logs.setGlobalLoggerProvider()`, and auto-patches
26
+ `console.log/info/warn/error/debug` to emit OTLP log records. Works on both
27
+ the Vercel (`@vercel/otel`) and self-hosted (`NodeSDK`) code paths. Graceful
28
+ flush + shutdown registered on SIGINT/SIGTERM/beforeExit.
29
+ - **`tracing.js` now calls `logs.setGlobalLoggerProvider()`** so consumers can
30
+ retrieve the logger via `@opentelemetry/api-logs` without depending on the
31
+ module export.
32
+ - **Docs updated** (`NPM_README.md`, `docs/LOGGING-QUICKSTART.md`) to
33
+ recommend `registerSecureNow` from `securenow/nextjs` for Next.js apps
34
+ instead of `securenow/register` + `securenow/console-instrumentation`
35
+ (which boots a full `NodeSDK` and conflicts with Next.js / `@vercel/otel`).
36
+
3
37
  ## Version 3.1.0 (Next.js Support Added)
4
38
 
5
39
  ### 🎉 New Features
@@ -101,13 +101,21 @@ app.listen(3000);
101
101
 
102
102
  ### Next.js
103
103
 
104
+ Next.js apps must use `securenow/nextjs` (not `securenow/register`, which
105
+ boots a full NodeSDK and conflicts with Next.js / `@vercel/otel`). Since
106
+ **6.0.1**, `registerSecureNow()` sets up the OTLP logs pipeline and auto-
107
+ patches `console.*` whenever `SECURENOW_LOGGING_ENABLED=1` is set — on both
108
+ Vercel and self-hosted (EC2, PM2, Docker) environments.
109
+
104
110
  ```typescript
105
111
  // instrumentation.ts (in project root)
106
112
  export async function register() {
107
113
  if (process.env.NEXT_RUNTIME === 'nodejs') {
114
+ // Must be set BEFORE loading securenow/nextjs
108
115
  process.env.SECURENOW_LOGGING_ENABLED = '1';
109
- await import('securenow/register');
110
- await import('securenow/console-instrumentation');
116
+
117
+ const { registerSecureNow } = await import('securenow/nextjs');
118
+ registerSecureNow({ captureBody: true });
111
119
  }
112
120
  }
113
121
  ```
@@ -119,6 +127,14 @@ SECURENOW_APPID=my-nextjs-app
119
127
  SECURENOW_INSTANCE=http://localhost:4318
120
128
  ```
121
129
 
130
+ Enable the instrumentation hook in `next.config.js`:
131
+
132
+ ```javascript
133
+ module.exports = {
134
+ experimental: { instrumentationHook: true },
135
+ };
136
+ ```
137
+
122
138
  ### Fastify
123
139
 
124
140
  ```javascript