Repository navigation
Releases
v14.2.1
Behaviour changes
- When
@nestjs/platform-ws12.5.0 or anotherupgradelistener shares the HTTP server, an upgrade request for a path that none of them serves is now closed after one second if nothing has answered it. SetunclaimedUpgradeTimeoutin thegraphql-wsoptions to change the delay, or to0to leave such sockets to the other listeners.
Bug fixes
- fix(apollo): skip aliased providers when exploring plugins by @thekhegay in #4235
- fix(graphql): keep nullable list items in PartialType by @thekhegay in #4233
- fix(plugin): resolve field type for
| undefinedunions by @thekhegay in #4234 - fix(graphql): close upgrade sockets that no listener claims by @kamilmysliwiec in #4236
Full Changelog: v14.2.0...v14.2.1
v14.2.0
This release fixes several security issues and a range of correctness bugs in schema generation, resolver binding and the drivers. Upgrading is recommended for all users of @nestjs/graphql, @nestjs/apollo and @nestjs/mercurius.
Security
| Advisory | Severity | Package | Summary |
|---|---|---|---|
| GHSA-8www-f354-mh8p | High | @nestjs/graphql |
Unauthenticated requests can crash applications that enable GraphQL subscriptions |
| GHSA-f2pj-v3fc-65xp | High | @nestjs/graphql |
Guards, interceptors and pipes are silently skipped on resolvers registered with useFactory or useValue |
| GHSA-c658-2mxh-7pqx | High | @nestjs/graphql |
Guards of a subclass resolver can be bypassed when its base resolver is also registered |
| GHSA-m88h-g79w-v5mc | Medium | @nestjs/graphql |
DateTime and Timestamp scalars accept invalid input, so null and invalid dates reach non-null arguments |
| GHSA-qcfh-v6vh-p698 | Medium | @nestjs/mercurius |
MercuriusFederationDriver ignores subscription filters and delivers events to all subscribers |
| GHSA-fvxv-c29c-43xc | Medium | @nestjs/apollo |
Credentials of failed outgoing HTTP requests can be exposed in GraphQL error responses |
| GHSA-68rj-86jm-2jwh | Medium | @nestjs/graphql |
Guarded field resolvers can be dropped when the resolvers option defines the same type |
| GHSA-5mvw-93v2-cm4m | Medium | @nestjs/apollo, @nestjs/mercurius |
Context objects returned by a context function can be shared across requests |
| GHSA-9c65-35pp-rvj7 | Medium | @nestjs/graphql |
Subscription filters receive schema-named arguments, which can deliver other users' events |
| GHSA-5xqp-272w-2j3q | Medium | @nestjs/graphql |
Subscription resolve callbacks run without guards when the operation is sent over HTTP |
Behaviour changes
Most applications need no changes. The fixes below either make silent misconfigurations fail loudly, or align runtime behaviour with what the schema and the documentation promise. Please review them before upgrading.
Startup errors for configurations that used to skip checks silently
- Factory or value resolvers with class-referenced enhancers. A resolver registered with
useFactory/useValuethat uses guards, interceptors or pipes referenced by class now fails at startup; before, these enhancers never ran. Register the resolver as a class or withuseClass, or pass enhancer instances. - Unattachable scoped enhancers and plugins. Request- or transient-scoped global enhancers that can't be attached to a resolver fail at startup, and so do request-scoped or transient
@Plugin()classes. - Ambiguous handlers. Two unrelated classes (or two methods) resolving the same type and field fail at startup. A subclass overriding its parent is fine: the most-derived class wins.
- Argument conflicts. These fail at schema build:
- a renamed
@ArgsType()property that collides with a named@Args(); - the same argument declared in two
@Args()with different types or defaults.
- a renamed
defaultValue: nullon a non-null argument or field fails at schema build. Addnullable: true, or drop the default.- Extra required arguments. A
@ResolveField()that adds a required argument the implemented interface field doesn't declare is a schema validation error. isOneOf. Derived input types inheritisOneOf, and the@oneOfdirective now sets it.- Ambiguous type names. Referencing a type by name (
@Field(() => 'Name')) when two types share that name fails. Reference the class, or scope the types withregisterIn. MercuriusGatewayDriverwithtransformSchemafails at startup; the option used to be ignored.- Schema-first with both
schemaandtypeDefs.resolverValidationOptionsnow apply to the merged schema.
Requests that are now rejected
- Malformed dates. Malformed
DateTime/Timestampinput is a validation error (HTTP 400). Valid date strings,Dateinstances and epoch-millisecond numbers keep working. - Custom scalars. A
nullresult from a custom scalar'sparseValue()/parseLiteral()is now treated as invalid input. Throw aGraphQLErrorfor input your scalar can't parse. - Subscriptions over HTTP are refused by
ApolloDriver,ApolloFederationDriverandMercuriusDriver. Use WebSocket. - Exact endpoint path on Express. The GraphQL endpoint matches its exact path:
/graphql/<anything>returns 404, andpath: '/'no longer catches every URL. A trailing slash still works. 'graphql-ws': falsenow disables the WebSocket endpoint. Asubscriptionsobject that enables no protocol no longer accepts upgrades.IntersectionType(). A field shared by both classes is non-null unless both allow null.- graphql-ws operations now go through Apollo's
validationRulesandformatError. - Request start hooks. An async request start hook (
ResolverDecoratorHost.setOnRequestStartHook()) is awaited, and if it rejects, the operation fails.
Schema changes
- Renamed properties. A subclass that redeclares a property under another schema name no longer keeps the parent's field.
- Mapped types.
PickType(),OmitType(),PartialType()andIntersectionType()no longer include fields inherited from a parent of another kind (e.g. an@ObjectType()parent of an@InputType()). @ResolveField()placement.- Field resolvers of a base resolver typed with a base or interface type appear only on the types actually served.
- Handler-only fields no longer leak between
include-scoped GraphQL modules.
includeand@Global()modules.includeno longer pulls in resolvers of@Global()modules; list them inincludeexplicitly.- Undecorated overrides. An override of a handler that isn't decorated no longer produces a field.
- Ordering.
- Field order in the SDL can change for types that implement several interfaces.
- Argument order for
@ArgsType()chains three or more levels deep is now root-first.
- Enums. Keys created by
Infinity/NaNreverse mappings and namespace-merged members are no longer enum values. - CLI plugin.
- It skips
protectedand#privatemembers. @HideField()also works when applied through a composed decorator.
- It skips
- Federation. Custom
buildFederatedSchemacallbacks receive only the__resolveReferenceresolvers; the other resolvers are attached separately.
Different resolvers or middleware for the same query
- Object subtypes run the nearest ancestor's
@ResolveField()handler, with its guards and middleware, instead of reading the property. To keep the old behaviour, declare a handler on the subtype. - Interfaces. When interfaces provide competing field resolvers, the most specific one wins, not the last one listed.
- Model field middleware.
@Field({ middleware })and@UseFieldMiddleware()on a model field also run when the field has a@ResolveField()handler, in the order global → model → handler, each once.- Global field middleware also runs on fields inherited from
@InterfaceType()classes.
- Unbound handler-only fields. A field declared only by a
@ResolveField(), that ends up on a type with no bound handler, returns an error and is listed in a startup warning. Before, it read the parent's property unguarded. __typenameof subclasses. The defaultresolveTypereturns the most-derived class, so__typenamenames the subclass.- Bare
@Resolver()subclasses inherit the parent's type. Subscription/Mutationobject types.@ResolveField()handlers on object types namedSubscriptionorMutationare treated as field resolvers.- Error conversion. Only real
HttpExceptioninstances are converted to GraphQL errors. - Context objects. A context object returned by a context function is copied per request, so class contexts lose
#privatefields. - Defaults.
- Omitted object argument defaults are completed with the input type's field defaults.
- Array and object defaults are fresh copies on every request.
- Class-level
@Extensions()are inherited by subclasses. directiveResolversis deprecated and logs a warning. It has had no effect since v9.2.0.
What's Changed
- fix(graphql): reject invalid dates and harden websocket upgrades (e29277b)
- fix(graphql): build federated schemas with the code-first options (43be3d5)
- fix(graphql): inherit fields of object and interface types consistently (2307121)
- fix(graphql): merge field resolver metadata per host type (2d1a89c)
- fix(graphql): resolve args and input fields by nearest declaration (cc19167)
- fix(apollo,mercurius): share context and subscription handling (ed19e23)
- fix(graphql): bind inherited field resolvers with the...
v14.1.1
What's Changed
- feat(apollo): support the node http adapter by @kamilmysliwiec in #4202
Full Changelog: v14.1.0...v14.1.1
v14.1.0
What's Changed
- fix(graphql): skip object prototype members when inferring defaults by @kamilmysliwiec in #4162
- fix(graphql): escape comment terminators in emitted descriptions by @thekhegay in #4174
- docs: add security policy by @kamilmysliwiec in #4176
- ci: migrate circleci config to version 2.1 by @kamilmysliwiec in #4178
- fix(apollo): stop the graphql-ws server of the federation driver by @kamilmysliwiec in #4186
- fix(apollo): require the integration versions that support apollo 5 by @kamilmysliwiec in #4187
- fix(graphql): route request-scoped creation errors through filters by @kamilmysliwiec in #4188
- fix(graphql): link the federation 2 spec in the auto schema file by @kamilmysliwiec in #4189
- fix(mercurius): require the gateway release that resolves union fields by @kamilmysliwiec in #4190
- fix(graphql): drop label from the federation 1 override directive by @kamilmysliwiec in #4191
- feat(graphql): export field metadata helper for custom mapped types by @kamilmysliwiec in #4192
- feat(graphql): add field middleware decorator for fields and resolvers by @kamilmysliwiec in #4193
- feat(graphql): allow fields to reference the root query type by @kamilmysliwiec in #4196
- feat(graphql): accept a custom ws server for graphql-ws subscriptions by @wasaybuilds in #4105
New Contributors
- @thekhegay made their first contribution in #4174
- @wasaybuilds made their first contribution in #4105
Full Changelog: v14.0.3...v14.1.0
v14.0.2
v14.0.2 (2026-09-23)
Bug fixes
graphql- #4144 fix(plugin): declare typescript as an optional peer dependency (@abouroubi)
apollo,graphql,mercurius
Committers: 4
- Kamil Mysliwiec (@kamilmysliwiec)
- Manuel Antunes (@Manuel-Antunes)
- Rafael Escobar (@paemuri)
- @abouroubi
v14.0.0
What's Changed
@nestjs/graphql, @nestjs/apollo and @nestjs/mercurius are now native ES modules, and this major targets the Nest 12 release line.
ESM migration
All three packages are published as pure ESM ("type": "module", compiled with NodeNext) behind a proper exports map. Deep imports into build internals are no longer resolvable — import from the package root:
// ❌ no longer resolvable
import { GraphQLModule } from '@nestjs/graphql/dist/graphql.module';
// ✅
import { GraphQLModule } from '@nestjs/graphql';The one deep entry point that remains public is the CLI plugin:
// ✅ still supported
import { before } from '@nestjs/graphql/plugin';require(esm) — CommonJS still works
You do not need to convert your app to ESM. Thanks to Node's require(esm) support, a CommonJS Nest app can keep require()-ing these packages unchanged. The @nestjs/graphql/plugin entry additionally ships a CJS shim (plugin.cjs), so ts-patch/ttypescript setups and nest-cli.json plugin registration continue to work as before.
GraphQL Playground has been removed
@apollo/server-plugin-landing-page-graphql-playground is gone — GraphiQL is the only built-in landing page. GraphiQL is enabled by default outside production, so most apps need no configuration at all.
playground survives as a deprecated boolean alias; the object form (playground settings) is no longer accepted:
// ❌ no longer supported
GraphQLModule.forRoot({ playground: { settings: { 'editor.theme': 'light' } } });
// ✅ boolean alias still works
GraphQLModule.forRoot({ playground: true });
// ✅ preferred
GraphQLModule.forRoot({ graphiql: true });
// or with options
GraphQLModule.forRoot({ graphiql: { url: '/graphql' } });Resolution order is graphiql → playground → default (GraphiQL when NODE_ENV !== 'production', Apollo's default landing page otherwise).
subscriptions-transport-ws has been removed
The unmaintained subscriptions-transport-ws transport is dropped; graphql-ws is the only supported subscriptions protocol. The subscriptions-transport-ws key is no longer part of SubscriptionConfig, and installSubscriptionHandlers: true now registers graphql-ws:
// ❌ no longer supported
GraphQLModule.forRoot({
subscriptions: { 'subscriptions-transport-ws': { path: '/graphql' } },
});
// ✅
GraphQLModule.forRoot({
subscriptions: { 'graphql-ws': { path: '/graphql' } },
});Clients still speaking the legacy graphql-ws subprotocol (Apollo Client 2, older subscriptions-transport-ws clients) must migrate to the graphql-transport-ws protocol.
Features
- Explicit
@ArgsType()names —@ArgsType('MyArgs')lets you name the generated type instead of relying on the class name. - Resolver decorator host — register decorators applied to every resolver method from a single place (also available in 13.4.3+).
Bug fixes
fix(schema): map incoming field data back to the property name (#1096)fix(@nestjs/graphql): preserve federation directives inautoSchemaFilefix(@nestjs/graphql): keep resolvers required when skipping argsfix(graphql): makeinfonullablefix(graphql,apollo): ensure extensions are added to resolved fieldsfix(apollo): respectuseGlobalPrefixon a custom subscription path
Upgrading
npm i @nestjs/graphql@14 @nestjs/apollo@14- Bump
@nestjs/common/@nestjs/coreto v12. - Replace any
playground: { ... }object config withgraphiql. - Replace
subscriptions['subscriptions-transport-ws']withsubscriptions['graphql-ws'], and migrate clients to thegraphql-transport-wsprotocol. - Replace deep
@nestjs/graphql/dist/...imports with root imports.
No source changes are required for CommonJS apps beyond the above.
v13.4.5
13.4.5 (2026-08-17)
Enhancements
graphql- #4054 feat(graphql): emit graphql descriptions as tsdoc comments (@joelluijmes)
Committers: 1
- Joël Luijmes (@joelluijmes)
v13.4.2
v13.4.1
13.4.1 (2026-05-19)
Bug fixes
apollo- #3999 fix(apollo): add granular control over HTTP status preservation for execution errors (@thiagojv)
- #3969 fix(@nestjs/apollo): expose schema transform hook on gateway driver (@maruthang)
graphql- #3970 fix(@nestjs/graphql): run plugin refresh hooks in registration order (@maruthang)
Committers: 3
- Maruthan G (@maruthang)
- Thiago Junqueira (@thiagojv)
- Yogeshwaran C (@yogeshwaran-c)
v13.4.0
13.4.0 (2026-04-30)
Features
apollo,graphql,mercurius
Bug fixes
graphql- #3959 fix(@nestjs/graphql): stop double-registering PickType inputs (@yogeshwaran-c)
- #3960 fix(@nestjs/graphql): de-duplicate per-target metadata in TargetMetadataCollection (@yogeshwaran-c)
apollo,graphql- #3962 fix(@nestjs/graphql): restore Timestamp scalar parsers in federation factory (@yogeshwaran-c)
Enhancements
graphql- #3963 fix(@nestjs/graphql): validate registerEnumType/createUnionType options eagerly (@yogeshwaran-c)
Dependencies
graphql- #3954 fix(deps): update graphql-tools monorepo (@renovate[bot])
Committers: 3
- Masato Noguchi (@joe-re)
- Mateus Welter Goettems (@mateuswgoettems)
- Yogeshwaran C (@yogeshwaran-c)