@sentry/junior 0.5.0 → 0.7.0
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/bin/junior.mjs +11 -1
- package/dist/{bot-PFLNB5PC.js → bot-ZKMCCT3D.js} +5 -3
- package/dist/{chunk-WM5Z766B.js → chunk-56WI5Q7P.js} +90 -33
- package/dist/{chunk-3ENACZ27.js → chunk-JRKU55W5.js} +489 -261
- package/dist/chunk-KT5HARSN.js +164 -0
- package/dist/{chunk-ECEC25CR.js → chunk-QHKQ2AWX.js} +1 -1
- package/dist/{chunk-BKYYVLVN.js → chunk-RKOO42TW.js} +53 -489
- package/dist/chunk-VW26MOSO.js +522 -0
- package/dist/cli/check.d.ts +8 -0
- package/dist/cli/check.js +303 -0
- package/dist/cli/init.js +7 -0
- package/dist/cli/run.d.ts +2 -1
- package/dist/cli/run.js +9 -1
- package/dist/cli/snapshot-warmup.js +3 -2
- package/dist/handlers/queue-callback.js +6 -4
- package/dist/handlers/router.js +7 -5
- package/dist/handlers/webhooks.js +1 -1
- package/package.json +5 -5
package/bin/junior.mjs
CHANGED
|
@@ -36,6 +36,15 @@ async function runInit(dir) {
|
|
|
36
36
|
await runInitFn(dir);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
async function runCheck(dir) {
|
|
40
|
+
const runCheckFn = await loadCliFunction(
|
|
41
|
+
"check",
|
|
42
|
+
"runCheck",
|
|
43
|
+
"Check module is unavailable; reinstall @sentry/junior and retry."
|
|
44
|
+
);
|
|
45
|
+
await runCheckFn(dir);
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
async function main() {
|
|
40
49
|
const runCli = await loadCliFunction(
|
|
41
50
|
"run",
|
|
@@ -44,7 +53,8 @@ async function main() {
|
|
|
44
53
|
);
|
|
45
54
|
const exitCode = await runCli(positionals, {
|
|
46
55
|
runInit,
|
|
47
|
-
runSnapshotCreate
|
|
56
|
+
runSnapshotCreate,
|
|
57
|
+
runCheck
|
|
48
58
|
});
|
|
49
59
|
if (exitCode !== 0) {
|
|
50
60
|
process.exit(exitCode);
|
|
@@ -4,10 +4,12 @@ import {
|
|
|
4
4
|
createNormalizingStream,
|
|
5
5
|
resetBotDepsForTests,
|
|
6
6
|
setBotDepsForTests
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-JRKU55W5.js";
|
|
8
|
+
import "./chunk-KT5HARSN.js";
|
|
9
|
+
import "./chunk-RKOO42TW.js";
|
|
10
10
|
import "./chunk-Z5E25LRN.js";
|
|
11
|
+
import "./chunk-PY4AI2GZ.js";
|
|
12
|
+
import "./chunk-VW26MOSO.js";
|
|
11
13
|
export {
|
|
12
14
|
appSlackRuntime,
|
|
13
15
|
bot,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
downloadPrivateSlackFile,
|
|
5
5
|
getThreadMessageTopic,
|
|
6
6
|
removeReactionFromMessage
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JRKU55W5.js";
|
|
8
8
|
import {
|
|
9
9
|
acquireQueueMessageProcessingOwnership,
|
|
10
10
|
completeQueueMessageProcessingOwnership,
|
|
@@ -12,11 +12,12 @@ import {
|
|
|
12
12
|
getQueueMessageProcessingState,
|
|
13
13
|
getStateAdapter,
|
|
14
14
|
refreshQueueMessageProcessingOwnership
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RKOO42TW.js";
|
|
16
16
|
import {
|
|
17
17
|
createRequestContext,
|
|
18
18
|
logError,
|
|
19
19
|
logException,
|
|
20
|
+
logInfo,
|
|
20
21
|
logWarn,
|
|
21
22
|
setSpanStatus,
|
|
22
23
|
withContext,
|
|
@@ -77,7 +78,9 @@ function createMessageOwnerToken() {
|
|
|
77
78
|
}
|
|
78
79
|
var QueueMessageOwnershipError = class extends Error {
|
|
79
80
|
constructor(stage, dedupKey) {
|
|
80
|
-
super(
|
|
81
|
+
super(
|
|
82
|
+
`Queue message ownership lost during ${stage} for dedupKey=${dedupKey}`
|
|
83
|
+
);
|
|
81
84
|
this.name = "QueueMessageOwnershipError";
|
|
82
85
|
}
|
|
83
86
|
};
|
|
@@ -89,6 +92,7 @@ var defaultProcessQueuedThreadMessageDeps = {
|
|
|
89
92
|
emoji: "eyes"
|
|
90
93
|
});
|
|
91
94
|
},
|
|
95
|
+
logInfo,
|
|
92
96
|
logWarn,
|
|
93
97
|
processRuntime: processThreadMessageRuntime
|
|
94
98
|
};
|
|
@@ -122,8 +126,25 @@ async function logThreadMessageFailure(payload, errorMessage) {
|
|
|
122
126
|
);
|
|
123
127
|
}
|
|
124
128
|
async function processQueuedThreadMessage(payload, deps = defaultProcessQueuedThreadMessageDeps) {
|
|
125
|
-
const existingMessageState = await getQueueMessageProcessingState(
|
|
129
|
+
const existingMessageState = await getQueueMessageProcessingState(
|
|
130
|
+
payload.dedupKey
|
|
131
|
+
);
|
|
126
132
|
if (existingMessageState?.status === "completed") {
|
|
133
|
+
deps.logInfo(
|
|
134
|
+
"queue_message_skipped_completed",
|
|
135
|
+
{
|
|
136
|
+
slackThreadId: payload.normalizedThreadId,
|
|
137
|
+
slackChannelId: getPayloadChannelId(payload),
|
|
138
|
+
slackUserId: getPayloadUserId(payload)
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"messaging.message.id": payload.message.id,
|
|
142
|
+
"app.queue.message_kind": payload.kind,
|
|
143
|
+
"app.queue.message_id": payload.queueMessageId,
|
|
144
|
+
"app.queue.processing_state": existingMessageState.status
|
|
145
|
+
},
|
|
146
|
+
"Skipping queue message because it is already completed"
|
|
147
|
+
);
|
|
127
148
|
return;
|
|
128
149
|
}
|
|
129
150
|
const ownerToken = createMessageOwnerToken();
|
|
@@ -133,6 +154,22 @@ async function processQueuedThreadMessage(payload, deps = defaultProcessQueuedTh
|
|
|
133
154
|
queueMessageId: payload.queueMessageId
|
|
134
155
|
});
|
|
135
156
|
if (claimResult === "blocked") {
|
|
157
|
+
deps.logInfo(
|
|
158
|
+
"queue_message_skipped_blocked",
|
|
159
|
+
{
|
|
160
|
+
slackThreadId: payload.normalizedThreadId,
|
|
161
|
+
slackChannelId: getPayloadChannelId(payload),
|
|
162
|
+
slackUserId: getPayloadUserId(payload)
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"messaging.message.id": payload.message.id,
|
|
166
|
+
"app.queue.message_kind": payload.kind,
|
|
167
|
+
"app.queue.message_id": payload.queueMessageId,
|
|
168
|
+
"app.queue.claim_result": claimResult,
|
|
169
|
+
"app.queue.processing_state": "processing"
|
|
170
|
+
},
|
|
171
|
+
"Skipping queue message because another worker owns it"
|
|
172
|
+
);
|
|
136
173
|
return;
|
|
137
174
|
}
|
|
138
175
|
const threadWasSerialized = isSerializedThread(payload.thread);
|
|
@@ -209,42 +246,62 @@ async function processQueuedThreadMessage(payload, deps = defaultProcessQueuedTh
|
|
|
209
246
|
queueMessageId: payload.queueMessageId
|
|
210
247
|
});
|
|
211
248
|
if (!failed && !(error instanceof QueueMessageOwnershipError)) {
|
|
212
|
-
throw new Error(
|
|
249
|
+
throw new Error(
|
|
250
|
+
`Failed to persist queue message failure state for dedupKey=${payload.dedupKey}: ${errorMessage}`
|
|
251
|
+
);
|
|
213
252
|
}
|
|
214
253
|
throw error;
|
|
215
254
|
}
|
|
216
255
|
}
|
|
217
256
|
|
|
218
257
|
// src/handlers/queue-callback.ts
|
|
219
|
-
var callbackHandler = createQueueCallbackHandler(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
"
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
258
|
+
var callbackHandler = createQueueCallbackHandler(
|
|
259
|
+
async (message, metadata) => {
|
|
260
|
+
if (metadata.topicName === getThreadMessageTopic()) {
|
|
261
|
+
const payload = {
|
|
262
|
+
...message,
|
|
263
|
+
queueMessageId: metadata.messageId
|
|
264
|
+
};
|
|
265
|
+
logInfo(
|
|
266
|
+
"queue_callback_received",
|
|
267
|
+
{
|
|
268
|
+
slackThreadId: payload.normalizedThreadId,
|
|
269
|
+
slackChannelId: payload.thread.channelId,
|
|
270
|
+
slackUserId: payload.message.author?.userId
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"messaging.message.id": payload.message.id,
|
|
274
|
+
"app.queue.message_kind": payload.kind,
|
|
275
|
+
"app.queue.message_id": payload.queueMessageId,
|
|
276
|
+
"app.queue.delivery_count": metadata.deliveryCount,
|
|
277
|
+
"app.queue.topic": metadata.topicName
|
|
278
|
+
},
|
|
279
|
+
"Received queue callback payload"
|
|
280
|
+
);
|
|
281
|
+
await withSpan(
|
|
282
|
+
"queue.process_message",
|
|
283
|
+
"queue.process_message",
|
|
284
|
+
{
|
|
285
|
+
slackThreadId: payload.normalizedThreadId,
|
|
286
|
+
slackChannelId: payload.thread.channelId,
|
|
287
|
+
slackUserId: payload.message.author?.userId
|
|
288
|
+
},
|
|
289
|
+
async () => {
|
|
290
|
+
await processQueuedThreadMessage(payload);
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"messaging.message.id": payload.message.id,
|
|
294
|
+
"app.queue.message_kind": payload.kind,
|
|
295
|
+
"app.queue.message_id": payload.queueMessageId,
|
|
296
|
+
"app.queue.delivery_count": metadata.deliveryCount,
|
|
297
|
+
"app.queue.topic": metadata.topicName
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
throw new Error(`Unexpected queue topic: ${metadata.topicName}`);
|
|
245
303
|
}
|
|
246
|
-
|
|
247
|
-
});
|
|
304
|
+
);
|
|
248
305
|
async function POST(request) {
|
|
249
306
|
const requestContext = createRequestContext(request, { platform: "queue" });
|
|
250
307
|
return withContext(requestContext, async () => {
|