本文へ移動
cccskills
無料GitHub で公開

opennext-cloudflare

Deploy Next.js to Cloudflare Workers using OpenNext adapter

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

OpenNext Cloudflare Skill

Deploy Next.js applications to Cloudflare Workers using the @opennextjs/cloudflare adapter.

When to use this skill

  • Deploying to Cloudflare Workers
  • Troubleshooting Cloudflare deployment issues
  • Configuring Cloudflare-specific features (KV, R2, D1)
  • Setting up CI/CD for Cloudflare

Current setup

  • Adapter: @opennextjs/cloudflare v1.19.11
  • Next.js: v16.2.9 (--dangerouslyUseUnsupportedNextVersion)
  • Worker name: namias
  • Compatibility flags: nodejs_compat

Files

FilePurpose
wrangler.jsoncCloudflare Workers configuration
open-next.config.tsOpenNext build configuration
src/middleware.tsMiddleware (renamed from proxy.ts for compatibility)

Build and deploy

Local build

npx @opennextjs/cloudflare build

Deploy to Cloudflare

npx wrangler deploy

CI/CD

Deployment happens via GitHub Actions on push to main:

  • .github/workflows/cloudflare-deploy.yml
  • Uses CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID

Common issues

"Cloudflare worker does not have a proxy.ts"

  • Cause: src/proxy.ts is not supported in newer OpenNext versions
  • Fix: Rename to src/middleware.ts

"Unsupported version of Next.js detected"

  • Cause: OpenNext doesn't officially support Next.js 16 yet
  • Fix: Add --dangerouslyUseUnsupportedNextVersion flag to build command

"Node.js compatibility mode is required"

  • Cause: Missing nodejs_compat compatibility flag
  • Fix: Add "compatibility_flags": ["nodejs_compat"] to wrangler.jsonc

"Global fetch is not available"

  • Cause: Missing global_fetch_strictly_public flag
  • Fix: Add "compatibility_flags": ["global_fetch_strictly_public"] to wrangler.jsonc

Environment variables

Set in Cloudflare dashboard or wrangler.jsonc:

VariablePurpose
NEXT_RUNTIMESet to edge
SANITY_API_CDNSanity CDN URL
SANITY_API_WRITESanity write API URL
SANITY_AUTH_TOKENSanity auth token
SANITY_REVALIDATE_SECRETRevalidation webhook secret
CANARY_SLACK_WEBHOOKCanary notification webhook
CANARY_DISCORD_WEBHOOKCanary notification webhook
CANARY_EMAILCanary notification email
CANARY_HONEYTOKENCanary token value
HONEYPOT_USERNAMEHoneypot form field
HONEYPOT_WEBSITEHoneypot form field

Checklist

  • wrangler.jsonc has correct compatibility flags
  • src/middleware.ts exists (not proxy.ts)
  • Environment variables set in Cloudflare dashboard
  • CI/CD workflow has correct secrets
  • Build succeeds with npx @opennextjs/cloudflare build

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Audit and fix accessibility issues across the portfolio to ensure WCAG 2.1 AA compliance.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

Creates a new blog post document in the Sanity studio. Use when the user wants to write a blog post, publish an article, or schedule a future post.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

Creates a new certification document in the Sanity studio. Use when the user wants to add a credential, certificate, or professional accreditation to the Certifications collection.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

Adds a new skill MD file to the studio's skills collection. Use when the user wants to author a new step-by-step recipe for the studio's in-app Skills tool or the .agents mirror.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

Creates a new project document in the Sanity studio. Use when the user wants to add a new portfolio project, a case study, or a work sample to the Projects collection.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

Creates a new experience document in the Sanity studio. Use when the user wants to add a job, role, internship, or work history entry to the Experience collection.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

PP-Namias のスキルをすべて見る

このスキルの問題を報告する