Repository navigation
feat(vercel): vercel queues - #16
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a Vercel local-queues dev bridge with lazy SDK loading and HMR-safe per-topic handlers, generalizes build exports for nested runner modules, unifies fetch header forwarding, defaults worker NODE_ENV to "development", and updates docs, package exports, tests, and fixtures. ChangesVercel Queue Dev Bridge
Sequence Diagram(s)sequenceDiagram
participant Consumer
participant registerVercelQueueConsumer
participant ensureSdk
participant QueueClient
participant registerDevConsumer
Consumer->>registerVercelQueueConsumer: register(topic, handler, retryAfterSeconds?)
registerVercelQueueConsumer->>registerVercelQueueConsumer: check/replace per-topic slot (HMR-safe)
alt first registration
registerVercelQueueConsumer->>ensureSdk: lazy import `@vercel/queue`
ensureSdk->>QueueClient: construct shared QueueClient
QueueClient->>registerVercelQueueConsumer: provide client
registerVercelQueueConsumer->>registerDevConsumer: registerDevConsumer(client, topic, consumerGroup, handler, retry)
else replacement
registerVercelQueueConsumer->>registerDevConsumer: replace handler (unregister previous)
end
registerVercelQueueConsumer->>Consumer: return unregister closure
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Around line 131-133: Update the AGENTS.md section that claims VERCEL_REGION
and NOW_REGION default to "dev1": these environment variables are no longer set
by the runner (see the comment in src/runners/vercel/worker.ts about SDKs
relying on valid values), so either remove the two lines mentioning
`VERCEL_REGION` and `NOW_REGION` or change them to state they are not defaulted
in local development and must be explicitly set if required; keep the `NODE_ENV`
line as-is and ensure the doc mentions the reason (Vercel SDKs expect valid
values) so readers understand why they must set VERCEL_REGION/NOW_REGION
themselves.
In `@src/runners/vercel/worker.ts`:
- Line 6: Update the coding guideline text that currently mandates setting
VERCEL_REGION and NOW_REGION to "dev1" so it matches the code change that
intentionally leaves those variables unset; specifically modify the guideline
string "Vercel runner worker should set environment variables: `VERCEL=1`,
`VERCEL_ENV=development`, `VERCEL_REGION=dev1`, `NOW_REGION=dev1`,
`NODE_ENV=development`" to remove `VERCEL_REGION=dev1` and `NOW_REGION=dev1`
(leaving `VERCEL=1`, `VERCEL_ENV=development`, `NODE_ENV=development`) or
alternatively clarify that VERCEL_REGION and NOW_REGION must not be defaulted,
ensuring the guidance in src/runners/vercel/worker.ts aligns with the comment
about intentionally not defaulting those env vars.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 01373cfe-2738-4e82-ac2b-e95ee27cef2c
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
AGENTS.mdbuild.config.mjspackage.jsonsrc/runners/vercel/queue-dev.tssrc/runners/vercel/runner.tssrc/runners/vercel/worker.ts
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…cal-dev # Conflicts: # package.json # pnpm-lock.yaml
6a78d92 to
14f92b1
Compare
| - `VERCEL_ENV` — `"development"` | ||
| - `VERCEL_REGION` — `"dev1"` | ||
| - `NOW_REGION` — `"dev1"` (legacy alias) | ||
| - `NODE_ENV` — `"development"` (gates `@vercel/queue`'s dev mode and other framework dev paths) |
There was a problem hiding this comment.
Should be updated once we avoid changing NODE_ENV global modification. (worst case scenario, as a temporary patch we override env during inpuiring vercel/queue sdk and immediately restore)
There was a problem hiding this comment.
Update: Seems many places use this check, we might upstream something like new QueueClient({ devMode: true }) (added todo)
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/runners/vercel/queue-dev.ts`:
- Line 60: The retry configuration currently uses a truthy check so
retryAfterSeconds = 0 is treated as falsy and disables retries; update the
conditional that sets the retry property (the line creating retry:
retryAfterSeconds ? () => ({ afterSeconds: retryAfterSeconds }) : undefined) to
explicitly test for undefined (e.g., retryAfterSeconds !== undefined) so a value
of 0 produces a retry function returning { afterSeconds: retryAfterSeconds }
while undefined still yields undefined.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c0e6d81f-daaa-42d2-95dd-3247c25fab1b
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
AGENTS.mdpackage.jsonsrc/runners/vercel/queue-dev.tstest/fixtures/app-env.mjstest/vercel.test.ts
✅ Files skipped from review due to trivial changes (1)
- AGENTS.md
…s, retry; add @vercel/queue devDep Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Support
@vercel/queueregisterDevConsumer()to enable passing queue triggers and consumers to register allowing bypassing registration viavercel.json. Exposes hooks for frameworks using env-runner to pass a consumer method, and triggers.Summary by CodeRabbit
New Features
Documentation
Chores
Tests