Skip to content

Conversation

@adriandlam
Copy link
Member

This PR introduces a getUrl method to the Queue interface and implements it across different world types (local, vercel, and postgres).

  • Added getUrl() to the Queue interface
  • Updated runtime.ts to use world.getUrl() instead of manually computing URLs

@changeset-bot
Copy link

changeset-bot bot commented Oct 25, 2025

🦋 Changeset detected

Latest commit: e59e65e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@workflow/world-postgres Patch
@workflow/world-vercel Patch
@workflow/world-local Patch
@workflow/world Patch
@workflow/core Patch
@workflow/cli Patch
@workflow/world-testing Patch
@workflow/next Patch
@workflow/nitro Patch
workflow Patch
@workflow/ai Patch

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

@vercel
Copy link
Contributor

vercel bot commented Oct 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Oct 26, 2025 7:24pm
example-nextjs-workflow-webpack Ready Ready Preview Comment Oct 26, 2025 7:24pm
example-workflow Ready Ready Preview Comment Oct 26, 2025 7:24pm
workbench-nitro-workflow Ready Ready Preview Comment Oct 26, 2025 7:24pm
workflow-docs Ready Ready Preview Comment Oct 26, 2025 7:24pm

@adriandlam adriandlam changed the title Add getUrl method to world implementations feat: add getUrl method to world implementations Oct 25, 2025

return { queue, createQueueHandler, getDeploymentId };
const getUrl: Queue['getUrl'] = () => {
return `https://${process.env.VERCEL_URL}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return `https://${process.env.VERCEL_URL}`;
const url = process.env.VERCEL_URL;
if (!url) {
throw new Error('VERCEL_URL environment variable is not set');
}
return `https://${url}`;

The getUrl() method doesn't validate that VERCEL_URL environment variable is set before using it, which will result in an invalid URL https://undefined if the variable is missing.

View Details

Analysis

Missing validation in Vercel world's getUrl() causes invalid URL when VERCEL_URL is undefined

What fails: Queue.getUrl() in packages/world-vercel/src/queue.ts returns the invalid URL https://undefined when the VERCEL_URL environment variable is not set, instead of validating the requirement like the parallel getDeploymentId() method does.

How to reproduce:

// In Vercel environment without VERCEL_URL set
delete process.env.VERCEL_URL;
const queue = createQueue();
const url = queue.getUrl(); // Returns "https://undefined"

Result: Returns "https://undefined". This invalid URL is persisted to workflow metadata at packages/core/src/runtime.ts:588 via workflowMetadata: { url: world.getUrl() }.

Expected: Should validate that VERCEL_URL is set and throw an error (consistent with getDeploymentId() which throws when VERCEL_DEPLOYMENT_ID is missing), preventing invalid URLs from being persisted. The original code in packages/core/src/workflow.ts:94-97 had conditional logic with a fallback, indicating this environment variable may not always be available.

Fix: Added validation to getUrl() that throws an error when VERCEL_URL is not set, matching the pattern used by getDeploymentId() in the same file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants