Skip to content

Fix mismatched parseCookie function for extract-cookie-value example - #32349

Merged
irvinebroque merged 1 commit into
cloudflare:productionfrom
JerrySMith13:patch-1
Sep 5, 2026
Merged

Fix mismatched parseCookie function for extract-cookie-value example#32349
irvinebroque merged 1 commit into
cloudflare:productionfrom
JerrySMith13:patch-1

Conversation

@JerrySMith13

Copy link
Copy Markdown
Contributor

Summary

In the example for extracting cookies in Workers, there was incorrect code in the Javascript and Typescript examples, where
a function called "parse", instead of cookie.parseCookie() was used. I fixed both examples, adding ~16 characters total

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review

⚠️ 1 warning found in commit 507d739.

👉 Fix in your agent 👈
Fix the following review findings in PR #32349 (https://github.com/cloudflare/cloudflare-docs/pull/32349).

Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
  or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

After triaging, follow this order:
1. Post a comment on this PR for any findings you are skipping, with the finding ID and your reasoning.
2. Then commit the fixes for the legitimate findings.

The comment must come before the commit — the bot reads PR comments when a new
push triggers a review, so skip comments posted after the push will be missed.

---

## Code Review

### Warnings (1)

#### CR-189e46f5a4da · Invalid import from cookie package
- **File:** `src/content/docs/workers/examples/extract-cookie-value.mdx` line 32
- **Issue:** The `cookie` npm package (linked in the page's External dependencies note) exports only `parse` and `serialize` — it has no `parseCookie` export. `import { parseCookie } from "cookie"` therefore resolves to `undefined`, and the call `parseCookie(...)` on line 37 throws `TypeError: parseCookie is not a function` when a user runs the example. The identical broken import/call is duplicated in the TypeScript example (lines 50 and 55).
- **Fix:** Use the package's actual API in both examples: `import { parse } from "cookie"` and `parse(request.headers.get("Cookie") || "")`. Alternatively, import from a package that does export `parseCookie`. Also verify the snippet matches the deployable example in cloudflare/docs-examples (workers/extract-cookie-value).

Code Review

This code review is in beta and may not always be helpful — use your judgment.

Warnings (1)
File Issue
workers/examples/extract-cookie-value.mdx line 32 Invalid import from cookie package — The cookie npm package (linked in the page's External dependencies note) exports only parse and serialize — it has no parseCookie export. import { parseCookie } from "cookie" therefore resolves to undefined, and the call parseCookie(...) on line 37 throws TypeError: parseCookie is not a function when a user runs the example. The identical broken import/call is duplicated in the TypeScript example (lines 50 and 55). Fix: Use the package's actual API in both examples: import { parse } from "cookie" and parse(request.headers.get("Cookie") || ""). Alternatively, import from a package that does export parseCookie. Also verify the snippet matches the deployable example in cloudflare/docs-examples (workers/extract-cookie-value).

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. On conflict, attempts to resolve automatically using AI. Stops with an explanation if confidence is not high enough.

@github-actions

Copy link
Copy Markdown
Contributor

Hey there, we've marked this pull request as stale because there's no recent activity on it. This label helps us identify PRs that might need updates (or to be closed out by our team if no longer relevant).

@github-actions github-actions Bot added the stale label Aug 11, 2026
@irvinebroque
irvinebroque enabled auto-merge (squash) September 5, 2026 15:43
@irvinebroque
irvinebroque requested a review from a team as a code owner September 5, 2026 16:23
@irvinebroque
irvinebroque merged commit 3f0ddfd into cloudflare:production Sep 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers Related to Workers product size/xs stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants