Commit 03301e8
fix(api-graphql): trigger WebSocket reconnection on auth errors (#14569)
Detect authentication errors (UnauthorizedException, NotAuthorizedException,
Token expired) in subscription error responses using exact errorType matching
and close the WebSocket to trigger reconnection with fresh tokens.
Handles both EVENT_SUBSCRIBE_ERROR (structured errors array) and GQL_ERROR
(payload errors) message types.
The socket close fires the existing CONNECTION_CLOSED → ConnectionDisrupted →
ReconnectionMonitor flow, so no changes needed in DataStore's disconnectionHandler.
Fixes #12954
Co-authored-by: Osama Rizk <41443120+osama-rizk@users.noreply.github.com>
Co-authored-by: Philipp Andreas Paul <phandpau@amazon.de>1 parent b4c0f94 commit 03301e8
2 files changed
Lines changed: 38 additions & 0 deletions
File tree
- .changeset
- packages/api-graphql/src/Providers/AWSWebSocketProvider
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
704 | 711 | | |
705 | 712 | | |
706 | 713 | | |
707 | 714 | | |
708 | 715 | | |
709 | 716 | | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
710 | 732 | | |
711 | 733 | | |
712 | 734 | | |
713 | 735 | | |
714 | 736 | | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
715 | 748 | | |
716 | 749 | | |
717 | 750 | | |
| |||
0 commit comments