Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 3b395d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
I'm Bonk, and I've done a quick review of your PR. PR #15381 adds Queue notification consumer CLI commands and display support.
|
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/test-server
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
52da7cd to
20c70b4
Compare
|
Codeowners approval required for this PR:
Show detailed file reviewers |
| export const queuesConsumerNotificationAddCommand = createCommand({ | ||
| metadata: { | ||
| description: "Add a Queue Notification Consumer", | ||
| owner: "Product: Queues", | ||
| status: "stable", | ||
| }, | ||
| behaviour: { supportTemporary: true }, |
20c70b4 to
d9f3fb1
Compare
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
d9f3fb1 to
f6e680a
Compare
There was a problem hiding this comment.
Happy for this to merge when you're ready. Just one minor nit, and Devin's comment which I've messaged you separately about (for posterity, if Queue notification consumers are still in beta as a product, I'd expect a different status in queuesConsumerNotificationAddCommand)
edit: Also some lint failures in CI to solve please!
| webhooks: toEntries(webhook), | ||
| }, | ||
| dead_letter_queue: args.deadLetterQueue, | ||
| } as PostTypedConsumerBody; |
There was a problem hiding this comment.
nit: satisfies PostTypedConsumerBody would let the type-checker protect you from mistakes in this object
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
| const queue = await getQueue(complianceConfig, accountId, queueName); | ||
| const consumer = queue.consumers.find((c) => c.type === "notification"); |
There was a problem hiding this comment.
🔴 Empty queue names target another queue
An empty queue name makes deleteNotificationConsumer target the account’s first returned queue and delete its notification consumer, if present. getQueue selects the first result without a name filter. Notification add and list also target that queue.
Learn more
The CLI accepts a quoted empty string for a required string positional. The queue lookup adds a name filter only for a truthy name, then returns the first queue in the response. The removal helper uses that queue’s ID for deletion. Notification add and notification list reach the same lookup through their client helpers.
Example: A deployment script runs wrangler queues consumer notification remove "$QUEUE_NAME" with an unset variable. If the first listed queue is billing-events and it has a notification consumer, Wrangler deletes that consumer instead of rejecting the empty name.
Recommended fix: Reject an empty queue name in getQueue before calling listQueues. Keep unnamed calls to listQueues working for account-wide listing. Add a CLI regression test that passes an explicit empty positional and asserts that Wrangler makes no queue API calls.
Was this helpful? React with 👍 or 👎 to provide feedback.
| metadata: { | ||
| description: "Configure Queue Notification Consumers", | ||
| owner: "Product: Queues", | ||
| status: "stable", |
There was a problem hiding this comment.
🔍 Beta feature advertised as stable
The changeset calls notification consumers beta, but queuesConsumerNotificationNamespace and all three commands declare stable. The command registry therefore omits beta labels from help.
Was this helpful? React with 👍 or 👎 to provide feedback.
| queueName: string | ||
| ): Promise<void> { | ||
| const queue = await getQueue(complianceConfig, accountId, queueName); | ||
| const consumer = queue.consumers.find((c) => c.type === "notification"); |
There was a problem hiding this comment.
🔍 Removal depends on consumer uniqueness
deleteNotificationConsumer selects the first match, while the notification list returns every match. Verify that the API permits at most one notification consumer per queue.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
|
||
| Add Queue notification consumer commands | ||
|
|
||
| Wrangler can now add, list, and remove Queue notification consumers configured with email, PagerDuty, or webhook destinations. The supporting deploy helpers expose notification consumer settings and deletion behavior. Queue notification consumers are currently in beta. |
There was a problem hiding this comment.
🔍 Missing notification command examples
The changeset introduces three commands without the usage examples requested by Wrangler’s changeset guidance.
Was this helpful? React with 👍 or 👎 to provide feedback.
| export async function deleteNotificationConsumer( | ||
| complianceConfig: ComplianceConfig, | ||
| accountId: string, | ||
| queueName: string | ||
| ): Promise<void> { |
There was a problem hiding this comment.
🔍 Undocumented notification removal contract
deleteNotificationConsumer and its Wrangler wrapper lack the required export JSDoc. Document the queue scope and the error for a missing notification consumer.
Was this helpful? React with 👍 or 👎 to provide feedback.
| import { listConsumers } from "../../../../client"; | ||
| import type { Consumer } from "../../../../client"; | ||
|
|
||
| export function mapNotificationConsumerForDisplay(consumer: Consumer) { |
| pagerduty: { | ||
| type: "string", | ||
| array: true, | ||
| description: "PagerDuty integration keys for notifications", | ||
| }, |
There was a problem hiding this comment.
🟨 PagerDuty keys in session output
When session output is enabled, --pagerduty writes raw integration keys into the session file. redactEventCode only masks event codes. Anyone who reads the file can use those keys to submit PagerDuty events.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
@jkoe-cf is this PR still relevant and being worked on? |
|
Nope no longer needed, will close |
Fixes MQ-1430
Adds a new notification consumer type for queues
A picture of a cute animal (not mandatory, but encouraged)