Conversation
… worker build step
…udflare environment
commit: |
There was a problem hiding this comment.
Pull request overview
This PR implements fixes for the Cloudflare e2e tests by enabling the Next.js adapter API integration. The changes introduce support for using adapter outputs in the build process, update task definitions for the Cloudflare-specific tests, and skip several failing tests with TODO comments indicating they need to be fixed in subsequent PRs.
Changes:
- Enabled
useAdapterOutputsflag and changedenableCacheInterceptiondefault totruein Cloudflare config - Renamed npm scripts from
build:workerande2etobuild:worker:cfande2e:cffor e2e test directories - Added new GitHub Actions workflow job for Cloudflare e2e tests
- Skipped multiple failing tests with TODO comments documenting issues
- Removed obsolete code related to the old build approach (plugin removal, unused imports)
- Added
.wrangler/to.gitignore
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| turbo.json | Added task definitions for e2e:cf and build:worker:cf |
| packages/cloudflare/src/cli/commands/build.ts | Added adapter path resolution when useAdapterOutputs is enabled |
| packages/cloudflare/src/cli/build/open-next/createServerBundle.ts | Removed obsolete plugin code and imports related to old build approach |
| packages/cloudflare/src/cli/build/build.ts | Added early return when useAdapterOutputs is enabled |
| packages/cloudflare/src/api/config.ts | Changed enableCacheInterception default to true, hardcoded useAdapterOutputs to true |
| examples-cloudflare/e2e/*/package.json | Renamed build:worker → build:worker:cf and e2e → e2e:cf |
| examples-cloudflare/e2e/pages-router/open-next.config.ts | Added explicit enableCacheInterception: true |
| examples-cloudflare/e2e//e2e/.test.ts | Skipped multiple failing tests with TODO comments |
| .gitignore | Added .wrangler/ directory |
| .github/workflows/local.yml | Added cloudflare job for e2e testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "preview": "pnpm build:worker && pnpm preview:worker", | ||
| "e2e": "playwright test -c e2e/playwright.config.ts", | ||
| "e2e:cf": "playwright test -c e2e/playwright.config.ts", | ||
| "build:worker-turbopack": "pnpm build:worker --openNextConfigPath open-next.turbopack.config.ts", |
There was a problem hiding this comment.
The build:worker-turbopack script references build:worker which no longer exists. This should reference build:worker:cf instead to work correctly.
| "build:worker-turbopack": "pnpm build:worker --openNextConfigPath open-next.turbopack.config.ts", | |
| "build:worker-turbopack": "pnpm build:worker:cf --openNextConfigPath open-next.turbopack.config.ts", |
| "build:worker": "pnpm opennextjs-cloudflare build", | ||
| "build:worker:cf": "pnpm opennextjs-cloudflare build", | ||
| "preview:worker": "pnpm opennextjs-cloudflare preview", | ||
| "preview": "pnpm build:worker && pnpm preview:worker", |
There was a problem hiding this comment.
The preview script still references the old build:worker command, but this has been renamed to build:worker:cf. This will cause the preview script to fail. Update the reference to use build:worker:cf instead.
| "preview": "pnpm build:worker && pnpm preview:worker", | |
| "preview": "pnpm build:worker:cf && pnpm preview:worker", |
| "preview": "pnpm build:worker && pnpm preview:worker", | ||
| "e2e": "playwright test -c e2e/playwright.config.ts", | ||
| "e2e:cf": "playwright test -c e2e/playwright.config.ts", | ||
| "build:worker-turbopack": "pnpm opennextjs-cloudflare build --openNextConfigPath open-next.turbopack.config.ts", |
There was a problem hiding this comment.
The build:worker-turbopack script references build:worker which no longer exists. This should reference build:worker:cf instead to work correctly.
| "build:worker-turbopack": "pnpm opennextjs-cloudflare build --openNextConfigPath open-next.turbopack.config.ts", | |
| "build:worker-turbopack": "pnpm run build:worker:cf -- --openNextConfigPath open-next.turbopack.config.ts", |
| queue, | ||
| cachePurge, | ||
| enableCacheInterception = false, | ||
| enableCacheInterception = true, |
There was a problem hiding this comment.
The JSDoc comment indicates the default for enableCacheInterception is false, but the code sets it to true. The documentation should be updated to reflect the actual default value.
| }, | ||
| dangerous: { | ||
| enableCacheInterception, | ||
| useAdapterOutputs: true, |
There was a problem hiding this comment.
The useAdapterOutputs is hardcoded to true for all Cloudflare configurations, which forces all users to use the adapter outputs approach. If this is intended to be a temporary change for testing purposes, consider making it configurable or document this breaking change. If it's permanent, this represents a significant architectural change that should be clearly documented.
|
|
||
| export default defineCloudflareConfig({ | ||
| incrementalCache: r2IncrementalCache, | ||
| enableCacheInterception: true, |
There was a problem hiding this comment.
The explicit enableCacheInterception: true is now redundant since the default value has been changed to true in the config. This line can be removed unless there's a specific reason to keep it explicit for documentation purposes.
| enableCacheInterception: true, |
| const projectOpts = { ...args, minify: !args.noMinify, sourceDir: nextAppDir }; | ||
|
|
||
| if (config.dangerous?.useAdapterOutputs) { | ||
| console.log("Using adapter outputs for building OpenNext bundle."); |
There was a problem hiding this comment.
Using console.log is inconsistent with the logging convention used throughout the codebase. The rest of the codebase uses the logger from @opennextjs/aws/logger.js for logging messages. Consider importing logger and using logger.info() instead for consistency.
| "build:worker": "pnpm opennextjs-cloudflare build", | ||
| "build:worker:cf": "pnpm opennextjs-cloudflare build", | ||
| "preview:worker": "pnpm opennextjs-cloudflare preview", | ||
| "preview": "pnpm build:worker && pnpm preview:worker", |
There was a problem hiding this comment.
The preview script still references the old build:worker command, but this has been renamed to build:worker:cf. This will cause the preview script to fail. Update the reference to use build:worker:cf instead.
| "preview": "pnpm build:worker && pnpm preview:worker", | |
| "preview": "pnpm build:worker:cf && pnpm preview:worker", |
| "preview": "pnpm build:worker && pnpm preview:worker", | ||
| "e2e": "playwright test -c e2e/playwright.config.ts", | ||
| "e2e:cf": "playwright test -c e2e/playwright.config.ts", | ||
| "build:worker-turbopack": "pnpm build:worker --openNextConfigPath open-next.turbopack.config.ts", |
There was a problem hiding this comment.
The build:worker-turbopack script references build:worker which no longer exists. This should reference build:worker:cf instead to work correctly.
| "build:worker-turbopack": "pnpm build:worker --openNextConfigPath open-next.turbopack.config.ts", | |
| "build:worker-turbopack": "pnpm build:worker:cf --openNextConfigPath open-next.turbopack.config.ts", |
| "build:worker": "pnpm opennextjs-cloudflare build", | ||
| "build:worker:cf": "pnpm opennextjs-cloudflare build", | ||
| "preview:worker": "pnpm opennextjs-cloudflare preview", | ||
| "preview": "pnpm build:worker && pnpm preview:worker", |
There was a problem hiding this comment.
The preview script still references the old build:worker command, but this has been renamed to build:worker:cf. This will cause the preview script to fail. Update the reference to use build:worker:cf instead.
| "preview": "pnpm build:worker && pnpm preview:worker", | |
| "preview": "pnpm build:worker:cf && pnpm preview:worker", |
Oops I merged it into the other branch instead of main.