File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @saleor/app-sdk " : patch
3+ ---
4+
5+ Expose inner JWT verification error causes for better debugging.
Original file line number Diff line number Diff line change @@ -35,13 +35,17 @@ export const verifyJWT = async ({
3535 debug ( "Token Claims decoded from jwt" ) ;
3636 } catch ( e ) {
3737 debug ( "Token Claims could not be decoded from JWT, will respond with Bad Request" ) ;
38- throw new Error ( `${ ERROR_MESSAGE } Could not decode authorization token.` ) ;
38+ throw new Error ( `${ ERROR_MESSAGE } Could not decode authorization token.` , {
39+ cause : e ,
40+ } ) ;
3941 }
4042
4143 try {
4244 verifyTokenExpiration ( tokenClaims ) ;
4345 } catch ( e ) {
44- throw new Error ( `${ ERROR_MESSAGE } ${ ( e as Error ) . message } ` ) ;
46+ throw new Error ( `${ ERROR_MESSAGE } ${ ( e as Error ) . message } ` , {
47+ cause : e ,
48+ } ) ;
4549 }
4650
4751 if ( tokenClaims . app !== appId ) {
@@ -69,6 +73,8 @@ export const verifyJWT = async ({
6973
7074 console . error ( e ) ;
7175
72- throw new Error ( `${ ERROR_MESSAGE } JWT signature verification failed.` ) ;
76+ throw new Error ( `${ ERROR_MESSAGE } JWT signature verification failed.` , {
77+ cause : e ,
78+ } ) ;
7379 }
7480} ;
You can’t perform that action at this time.
0 commit comments