test(nextjs): Added nextjs CF workers test app#18928
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds E2E tests for Next.js 16 running on Cloudflare Workers using OpenNext. The primary goal is to verify that the Sentry SDK doesn't crash when running in this environment, with several tests intentionally skipped due to known limitations in the CF Workers runtime.
Changes:
- New test application configuration for Next.js 16 on Cloudflare Workers with OpenNext
- Comprehensive test suite covering various Next.js features (middleware, server components, route handlers, ISR, metrics)
- Multiple tests are skipped with TODOs noting CF Workers-specific limitations
Reviewed changes
Copilot reviewed 57 out of 63 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| wrangler.jsonc | Cloudflare Workers configuration with nodejs_compat and asset bindings |
| package.json | Dependencies and build scripts for CF Workers deployment |
| tsconfig.json | TypeScript configuration for the test application |
| next.config.ts | Next.js configuration with Sentry integration |
| open-next.config.ts | OpenNext configuration for Cloudflare deployment |
| playwright.config.mjs | Playwright test configuration |
| sentry.server.config.ts | Server-side Sentry configuration |
| sentry.edge.config.ts | Edge runtime Sentry configuration |
| instrumentation.ts | Server instrumentation with onRequestError hook |
| instrumentation-client.ts | Client-side instrumentation |
| middleware.ts | Edge middleware implementation |
| tests/*.test.ts | Test files covering various Next.js features with CF Workers |
| app/* | Test application pages, layouts, and route handlers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/wrangler.jsonc
Show resolved
Hide resolved
dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/package.json
Outdated
Show resolved
Hide resolved
dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/route-handler.test.ts
Show resolved
Hide resolved
dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/middleware.ts
Show resolved
Hide resolved
dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tsconfig.json
Show resolved
Hide resolved
dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/package.json
Outdated
Show resolved
Hide resolved
dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/app/redirect/origin/page.tsx
Show resolved
Hide resolved
...kages/e2e-tests/test-applications/nextjs-16-cf-workers/app/nested-rsc-error/[param]/page.tsx
Show resolved
Hide resolved
...kages/e2e-tests/test-applications/nextjs-16-cf-workers/app/nested-rsc-error/[param]/page.tsx
Show resolved
Hide resolved
dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/middleware.test.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Opennext + CF workers don't work with proxy yet, but it works with Next.js 16 somehow, I think CF workers convert it to a serverless function or something. I will take a look later.
FYI its a known opennext cloudflare adapter limitation; they don't support proxy middleware yet @logaretm . Issues to track: |
This PR sets up E2E tests for Next.js 16 running on Cloudflare Workers using OpenNext.
Some tests yield different transaction names and span attributes, I will review each of the skipped tests and review the differences and if we should either consolidate the edge runtime behavior with the node runtime behavior.
Known Limitations
Those are the test failures that required skipping.
proxyfilename not being picked up by opennext, yetmiddlewareworks on Next 16 😕transaction_info.sourceis'url'instead of'route''resolve segment modules'instead of specific component names)http.response.status_code/http.status_codeattributesI plan to follow up with another PR to address these, but the higher priority is making sure the SDK doesn't crash and works to some degree on CF worker apps.
Closes #18929 (added automatically)