Commit 244ef62
authored
fix(node): feed in our API key and options to the process end flush (#1284)
## 🧰 Changes
This fixes an issue in the Node SDK where when we call
`process.on('exit')` to flush the log queue when the process ends we
aren't feeding an API key or SDK options into the `doSend()` call,
resulting in the SDK crashing the server it's being run in:
```
[server] /Users/username/Documents/GitHub/readme/node_modules/readmeio/dist/src/lib/metrics-log.js:85
[server] if (options.fireAndForget) {
[server] ^
[server]
[server] TypeError: Cannot read properties of undefined (reading 'fireAndForget')
[server] at metricsAPICall (/Users/username/Documents/GitHub/readme/node_modules/readmeio/src/lib/metrics-log.ts:134:15)
[server] at process.doSend (/Users/username/Documents/GitHub/readme/node_modules/readmeio/src/lib/log.ts:28:17)
[server] at process.emit (node:events:531:35)
[server] at process.emit (node:domain:489:12)
[server] at process.emit.sharedData.processEmitHook.installedValue [as emit] (/Users/username/Documents/GitHub/readme/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40)
[server] at process.exit (node:internal/process/per_thread:240:15)
[server] at process.emit.sharedData.processEmitHook.installedValue [as emit] (/Users/username/Documents/GitHub/readme/node_modules/@cspotcode/source-map-support/source-map-support.js:750:17)
[server] at process._fatalException (node:internal/process/execution:155:25)
[server]
[server] Node.js v22.21.0
[server] [nodemon] app crashed - waiting for file changes before starting...
```1 parent 35e81e6 commit 244ef62
1 file changed
+14
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
37 | 40 | | |
38 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
| |||
117 | 125 | | |
118 | 126 | | |
119 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
120 | 133 | | |
121 | 134 | | |
122 | 135 | | |
| |||
0 commit comments