Skip to content

Commit 0a20b2e

Browse files
committed
doc: add note about handler precedence and conflict warnings for includeRouter method
1 parent 326587e commit 0a20b2e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/event-handler/src/appsync-graphql/AppSyncGraphQLResolver.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ class AppSyncGraphQLResolver extends Router {
188188
* All resolver handlers, batch resolver handlers, and exception handlers
189189
* from the included routers will be available in the current resolver.
190190
*
191+
* **Note:** When multiple routers register handlers for the same type and field combination
192+
* (e.g., both `userRouter` and `postRouter` define `Query.getPost`), the handler from the
193+
* last included router takes precedence and will override earlier registrations.
194+
* This behavior also applies to exception handlers registered for the same error class.
195+
* A warning is logged to help you identify potential conflicts when handlers are overridden.
196+
*
191197
* @example
192198
* ```ts
193199
* import { AppSyncGraphQLResolver, Router } from '@aws-lambda-powertools/event-handler/appsync-graphql';

0 commit comments

Comments
 (0)