Skip to content

fix(apollo): expose execution error status normalization#3998

Open
yudin-s wants to merge 1 commit into
nestjs:v14.0.0from
yudin-s:fix/apollo-http-status-flag
Open

fix(apollo): expose execution error status normalization#3998
yudin-s wants to merge 1 commit into
nestjs:v14.0.0from
yudin-s:fix/apollo-http-status-flag

Conversation

@yudin-s
Copy link
Copy Markdown

@yudin-s yudin-s commented May 18, 2026

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: Fixes #3997

autoTransformHttpErrors currently also enables HTTP 200 normalization for execution-level errors. This makes it impossible to keep Nest HTTP exception transformation enabled while preserving HTTP status codes for contracts that rely on 4xx signaling.

What is the new behavior?

Execution-level status normalization is controlled by a dedicated Apollo driver option: forceHttpStatus200ForExecutionErrors.

By default, transformed Nest HttpExceptions preserve their mapped HTTP status while keeping the existing GraphQL error extensions. Enabling forceHttpStatus200ForExecutionErrors restores the HTTP 200 normalization behavior introduced for GraphQL clients that require { data, errors } responses with a 2xx transport status. Request-level parse/validation errors are unaffected.

Does this PR introduce a breaking change?

  • Yes
  • No

This changes the default introduced by #3940 so execution-level errors are no longer forced to HTTP 200 unless forceHttpStatus200ForExecutionErrors is enabled.

Other information

Targeted to v14.0.0, the active release branch.

Local checks:

  • yarn test:e2e:apollo
  • yarn workspace @nestjs/apollo test:e2e tests/e2e/issue-2940-http-error-status.spec.ts
  • yarn build
  • yarn oxlint packages/apollo/lib/drivers/apollo-base.driver.ts packages/apollo/lib/interfaces/apollo-driver-config.interface.ts packages/apollo/tests/e2e/issue-2940-http-error-status.spec.ts packages/apollo/tests/e2e/guards-filters.spec.ts packages/apollo/tests/e2e/pipes.spec.ts
  • yarn prettier packages/apollo/lib/drivers/apollo-base.driver.ts packages/apollo/lib/interfaces/apollo-driver-config.interface.ts packages/apollo/tests/e2e/issue-2940-http-error-status.spec.ts packages/apollo/tests/e2e/guards-filters.spec.ts packages/apollo/tests/e2e/pipes.spec.ts --check
  • git diff --check

@yudin-s yudin-s force-pushed the fix/apollo-http-status-flag branch from c894de3 to 2b29b39 Compare May 18, 2026 13:00
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.

1 participant