Skip to content

[Browser Run] Add pre-rendering tutorial#31209

Draft
harshil1712 wants to merge 3 commits into
productionfrom
br/pre-rendering
Draft

[Browser Run] Add pre-rendering tutorial#31209
harshil1712 wants to merge 3 commits into
productionfrom
br/pre-rendering

Conversation

@harshil1712
Copy link
Copy Markdown
Contributor

Summary

Adds a Browser Run tutorial that shows how to use a Worker and the /content Quick Action to pre-render JavaScript-heavy pages for crawlers or integrations. The tutorial focuses on a minimal implementation with hostname validation and notes caching as a production improvement.

Screenshots (optional)

Documentation checklist

  • The change adheres to the documentation style guide.
  • If a larger change, such as adding a new page, an issue has been opened in relation to any incorrect or out of date information that this PR fixes.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/browser-run/ @mchenco, @cloudflare/product-owners, @celso, @kathayl, @dcpena, @meddulla, @simonabadoiu, @jonnyparris, @ruifigueira, @Refaerds, @omarmosid

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

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

2 issues need attention before merge.

  • MEDIUM src/content/docs/browser-run/how-to/pre-render-pages.mdx (lines 134–139): The catch block returns HTTP 400 for all errors, including upstream Browser Run failures. Upstream errors should return 502 or 503 so callers know to retry.
  • LOW src/content/docs/browser-run/how-to/pre-render-pages.mdx: The numbered procedure sections should be wrapped in <Steps> to follow the procedures style guide.

Existing Browser Run how-to pages also omit <Steps>, but new content should follow the current style guide.

Comment on lines +134 to +139
} catch (error) {
return Response.json(
{ error: error instanceof Error ? error.message : "Unknown error" },
{ status: 400 },
);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Return 502 for upstream Browser Run failures instead of 400:

Suggested change
} catch (error) {
return Response.json(
{ error: error instanceof Error ? error.message : "Unknown error" },
{ status: 400 },
);
}
} catch (error) {
const message = error instanceof Error ? error.message : "Unknown error";
const status = message.startsWith("Browser Run failed") ? 502 : 400;
return Response.json({ error: message }, { status });
}

@ask-bonk ask-bonk Bot added documentation Documentation edits content:new Request for new/missing content labels Jun 3, 2026
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Jun 3, 2026

Completed the review on PR #31209.

Labels applied: documentation, content:new (in addition to existing size/m and product:browser-run).

Summary of changes: This PR adds a new Browser Run tutorial (pre-render-pages.mdx) that demonstrates how to build a Worker using the /content Quick Action to pre-render JavaScript-heavy pages for crawlers and integrations. It includes hostname validation, a minimal Wrangler config, and guidance on testing with wrangler dev --remote.

Issues flagged:

  • MEDIUM (line 134): The catch block returns HTTP 400 for all errors, including upstream Browser Run failures. I posted an inline suggestion to distinguish client errors (400) from upstream failures (502) so crawlers know when to retry.
  • LOW (structural): The numbered procedure sections aren't wrapped in <Steps>. New tutorials should follow the current procedures style guide, even though some older Browser Run how-to pages also omit it.

Posted 1 inline suggestion via the review. No build-breakers or incorrect API usage were found — the quickAction("content") usage, BrowserRun type, and $today compatibility date all match existing patterns in the Browser Run docs.

github run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

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

Labels

content:new Request for new/missing content documentation Documentation edits product:browser-run size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants