fix(apollo): expose execution error status normalization#3998
Open
yudin-s wants to merge 1 commit into
Open
Conversation
c894de3 to
2b29b39
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: Fixes #3997
autoTransformHttpErrorscurrently 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. EnablingforceHttpStatus200ForExecutionErrorsrestores 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?
This changes the default introduced by #3940 so execution-level errors are no longer forced to HTTP 200 unless
forceHttpStatus200ForExecutionErrorsis enabled.Other information
Targeted to
v14.0.0, the active release branch.Local checks:
yarn test:e2e:apolloyarn workspace @nestjs/apollo test:e2e tests/e2e/issue-2940-http-error-status.spec.tsyarn buildyarn 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.tsyarn 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 --checkgit diff --check