Unverified Commit 0abfbcbc authored by Jamiboy Mohammad's avatar Jamiboy Mohammad Committed by GitHub

test: enable compatible body-size cases in deploy (#98911)

## Summary

Based on #99392. Stack: #99012 → #98994 → #99392 → #98911. This PR now
contains its own `skipDeployment` → `@force-gate` conversions and
removal of `skipped` returns, with no dependency on Josh’s migration
PRs. Enable only the two body-size tests confirmed passing in both
deployment CI variants: a 4 MiB request with a 5 MiB Next.js buffer and
a 1 MiB request with a 2 MiB buffer.

Keep the other seven tests gated and replace the migration TODOs with
verified reasons:
- The test deployment enforces the documented 4.5 MB Vercel payload
limit. Requests of 5, 6, 10, 11, 20, and 51 MiB receive HTTP 413,
independently of the Next.js buffering setting.
- The 3 MiB request is accepted, but Vercel forwards the entire body
instead of applying Next.js's local 2 MiB truncation.

The 5 MiB and 2 MiB suite gates are narrowed to their failing over-limit
tests. All test bodies and assertions are unchanged. The redundant
dev-only image exclusion is handled separately in #98908.

## Verification

- Restacked above #99392; `git range-diff` confirms the body-size patch
is unchanged.

- Prettier and ESLint passed.
- Verified test bodies and assertions are unchanged after removing the
legacy deployment skips; all four force-gates attach. A collection-only
check with fixture setup stubbed confirms two tests enabled and seven
gated in deploy, and all nine enabled locally.
- Prior reproduction on canary:
https://github.com/vercel/next.js/actions/runs/35401223346/job/105783820893
and
https://github.com/vercel/next.js/actions/runs/35401223346/job/105783820915
(2 passed, 7 failed in each).
- Direct HTTP reproduction returned Vercel's FUNCTION_PAYLOAD_TOO_LARGE
for 5 MiB with a configured 50 MiB Next.js buffer; 4 MiB succeeded.
- Full suite execution remains blocked by the local installation’s
missing `node-fetch`; bootstrap/watch builds stalled during the
first-layer validation. CI must validate execution on the new stack.

<!-- NEXT_JS_LLM -->
parent 84dd9be7
...@@ -2,15 +2,15 @@ import { nextTestSetup } from 'e2e-utils' ...@@ -2,15 +2,15 @@ import { nextTestSetup } from 'e2e-utils'
import { fetchViaHTTP } from 'next-test-utils' import { fetchViaHTTP } from 'next-test-utils'
describe('client-max-body-size', () => { describe('client-max-body-size', () => {
// These 5, 10, and 11 MiB requests exceed the Vercel test deployment's
// 4.5 MB payload limit and receive 413 instead of 200. Next.js's 10 MiB
// buffering limit does not configure Vercel's separate acceptance limit.
// @force-gate !deploy
describe('default 10MB limit', () => { describe('default 10MB limit', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
// Deployed environment has it's own configured limits.
skipDeployment: true,
}) })
if (skipped) return
it('should accept request body over 10MB but only buffer up to limit', async () => { it('should accept request body over 10MB but only buffer up to limit', async () => {
const bodySize = 11 * 1024 * 1024 // 11MB const bodySize = 11 * 1024 * 1024 // 11MB
const body = 'x'.repeat(bodySize) const body = 'x'.repeat(bodySize)
...@@ -78,9 +78,8 @@ describe('client-max-body-size', () => { ...@@ -78,9 +78,8 @@ describe('client-max-body-size', () => {
}) })
describe('custom limit with string format', () => { describe('custom limit with string format', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
nextConfig: { nextConfig: {
experimental: { experimental: {
proxyClientMaxBodySize: '5mb', proxyClientMaxBodySize: '5mb',
...@@ -88,8 +87,9 @@ describe('client-max-body-size', () => { ...@@ -88,8 +87,9 @@ describe('client-max-body-size', () => {
}, },
}) })
if (skipped) return // The 6 MiB request exceeds Vercel's 4.5 MB payload limit and receives 413.
// Next.js's 5 MiB buffering limit does not raise that platform limit.
// @force-gate !deploy
it('should accept request body over custom 5MB limit but only buffer up to limit', async () => { it('should accept request body over custom 5MB limit but only buffer up to limit', async () => {
const bodySize = 6 * 1024 * 1024 // 6MB const bodySize = 6 * 1024 * 1024 // 6MB
const body = 'a'.repeat(bodySize) const body = 'a'.repeat(bodySize)
...@@ -137,9 +137,8 @@ describe('client-max-body-size', () => { ...@@ -137,9 +137,8 @@ describe('client-max-body-size', () => {
}) })
describe('custom limit with number format', () => { describe('custom limit with number format', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
nextConfig: { nextConfig: {
experimental: { experimental: {
proxyClientMaxBodySize: 2 * 1024 * 1024, // 2MB in bytes proxyClientMaxBodySize: 2 * 1024 * 1024, // 2MB in bytes
...@@ -147,8 +146,9 @@ describe('client-max-body-size', () => { ...@@ -147,8 +146,9 @@ describe('client-max-body-size', () => {
}, },
}) })
if (skipped) return // Vercel accepts all 3 MiB without applying Next.js's 2 MiB local
// middleware buffering limit, so the truncation assertion fails.
// @force-gate !deploy
it('should accept request body over custom 2MB limit but only buffer up to limit', async () => { it('should accept request body over custom 2MB limit but only buffer up to limit', async () => {
const bodySize = 3 * 1024 * 1024 // 3MB const bodySize = 3 * 1024 * 1024 // 3MB
const body = 'c'.repeat(bodySize) const body = 'c'.repeat(bodySize)
...@@ -195,10 +195,13 @@ describe('client-max-body-size', () => { ...@@ -195,10 +195,13 @@ describe('client-max-body-size', () => {
}) })
}) })
// These 20 and 51 MiB requests exceed the Vercel test deployment's
// 4.5 MB payload limit and receive 413 instead of 200. Setting Next.js's
// buffer to 50 MiB does not raise Vercel's separate acceptance limit.
// @force-gate !deploy
describe('large custom limit', () => { describe('large custom limit', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
nextConfig: { nextConfig: {
experimental: { experimental: {
proxyClientMaxBodySize: '50mb', proxyClientMaxBodySize: '50mb',
...@@ -206,8 +209,6 @@ describe('client-max-body-size', () => { ...@@ -206,8 +209,6 @@ describe('client-max-body-size', () => {
}, },
}) })
if (skipped) return
it('should accept request body up to 50MB with custom limit', async () => { it('should accept request body up to 50MB with custom limit', async () => {
const bodySize = 20 * 1024 * 1024 // 20MB const bodySize = 20 * 1024 * 1024 // 20MB
const body = 'e'.repeat(bodySize) const body = 'e'.repeat(bodySize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment