Skip to content

docs(cloudflare): document populateCache setup behind Cloudflare Access#218

Merged
petebacondarwin merged 1 commit into
mainfrom
cli-docs-cloudflare-access
May 15, 2026
Merged

docs(cloudflare): document populateCache setup behind Cloudflare Access#218
petebacondarwin merged 1 commit into
mainfrom
cli-docs-cloudflare-access

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

Summary

  • Adds a new sub-section to pages/cloudflare/cli.mdx under the populateCache command, explaining what to do when the temporary open-next-cache-populate.<account>.workers.dev helper Worker is fronted by a Cloudflare Access application (the scenario introduced by Allow populating R2 when the domain is protected by Cloudflare Access opennextjs-cloudflare#1261).
  • Adds a cross-linked troubleshooting entry in pages/cloudflare/troubleshooting.mdx for the two error messages users typically hit in this scenario (Failed to send request to R2 worker and Could not determine Cloudflare auth credentials after login).

Why

The only existing guidance for this setup is the @opennextjs/cloudflare v1.19.10 changelog entry, which reads:

create a "Service Auth" policy for "open-next-cache-populate..workers.dev"

That phrasing is ambiguous about whether to create a new Access application for the hostname or attach the policy to an existing application that already covers it. The discussion in opennextjs/opennextjs-cloudflare#1171 (comment #4460317679) shows multiple users falling into the same trap. The user that eventually got it working reported:

if you already have an Access application whose URL covers open-next-cache-populate.<account>.workers.dev (e.g. a *.<account>.workers.dev wildcard), just attach the service auth policy from #1261 to that existing application. DO NOT create a new application for open-next-cache-populate.<account>.workers.dev.

The new sub-section captures that — phrased as observed behaviour rather than a hard rule, since we don't yet know the root cause of why the separate-application setup blocks the upload.

Notes

  • Prettier passes (npx prettier@3.5.2 --check pages/cloudflare/cli.mdx pages/cloudflare/troubleshooting.mdx).
  • The new heading is level-4 (####) so it nests under the existing ### populateCache command section in the page TOC.
  • The companion in-code comment in populate-cache.ts is being updated in a separate PR on opennextjs/opennextjs-cloudflare so future maintainers don't re-introduce the ambiguous wording in changelogs.

Adds a sub-section to the CLI docs explaining how to make
`populateCache remote` (and the `deploy` / `upload` commands that
call it) work when the temporary `open-next-cache-populate` helper
Worker is fronted by a Cloudflare Access application, plus a
cross-linked troubleshooting entry for the two error messages users
typically see in this scenario.

The previous guidance (only present in the v1.19.10 changelog entry)
was ambiguous about whether to create a new Access application or
attach the policy to an existing one. Per the discussion in
opennextjs/opennextjs-cloudflare#1171, attaching the Service Auth
policy to the existing application that already covers the hostname
is the working path; creating a separate application scoped to
`open-next-cache-populate.<account>.workers.dev` has been observed
to block the upload even alongside the existing wildcard app.
Copy link
Copy Markdown
Collaborator

@james-elicx james-elicx left a comment

Choose a reason for hiding this comment

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

looks good

@petebacondarwin petebacondarwin merged commit 9adf5a2 into main May 15, 2026
1 check passed
@petebacondarwin petebacondarwin deleted the cli-docs-cloudflare-access branch May 15, 2026 17:52
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.

2 participants