@@ -591,67 +591,21 @@ test("invokeRuntime aborts an established IAM response stream", async () => {
591591 expect ( result ) . toBe ( "AbortError" ) ;
592592} ) ;
593593
594- test ( "IAM invoke failures preserve safe SDK diagnostics without arbitrary causes" , async ( ) => {
595- const { logger, logs } = captureLogs ( ) ;
596- const core = coreWithDataSend ( async ( ) => {
597- throw Object . assign ( new Error ( "failed with secret request content" ) , {
598- name : "AccessDeniedException" ,
599- $metadata : {
600- httpStatusCode : 403 ,
601- requestId : "request-123" ,
602- } ,
603- } ) ;
604- } , logger ) ;
605-
606- const caught = await core . runtime
607- . invokeRuntime (
608- {
609- runtimeId : "runtime-123" ,
610- accountId : "123456789012" ,
611- qualifier : "DEFAULT" ,
612- payload : new TextEncoder ( ) . encode ( "secret payload" ) ,
613- contentType : "application/json" ,
614- applicationHeaders : [ [ "X-Secret" , "secret-header-value" ] ] ,
615- } ,
616- { region : "us-east-1" } ,
617- )
618- . catch ( ( caught : Error ) => caught ) ;
619- const error = caught as Error ;
620-
621- expect ( error . message ) . toBe (
622- "Runtime invocation failed (AccessDeniedException, HTTP 403, request ID request-123)" ,
623- ) ;
624- expect ( error . message ) . not . toContain ( "secret request content" ) ;
625- expectSafeDebugLog (
626- logs ,
627- "Runtime invocation SDK request failed" ,
628- {
629- authMode : "IAM" ,
630- runtimeId : "runtime-123" ,
631- qualifier : "DEFAULT" ,
632- region : "us-east-1" ,
633- errorName : "AccessDeniedException" ,
634- httpStatusCode : 403 ,
635- requestId : "request-123" ,
594+ test ( "IAM invoke preserves modeled AWS service errors" , async ( ) => {
595+ const failure = new ValidationException ( {
596+ message : "Runtime session ID must contain at least 33 characters" ,
597+ reason : "FieldValidationFailed" ,
598+ $metadata : {
599+ httpStatusCode : 400 ,
600+ requestId : "request-456" ,
636601 } ,
637- [ "secret request content" , "secret payload" , "secret-header-value" ] ,
638- ) ;
639- } ) ;
640-
641- test ( "IAM invoke failures include messages from modeled AWS service errors" , async ( ) => {
602+ } ) ;
642603 const core = coreWithDataSend ( async ( ) => {
643- throw new ValidationException ( {
644- message : "Runtime session ID must contain at least 33 characters" ,
645- reason : "FieldValidationFailed" ,
646- $metadata : {
647- httpStatusCode : 400 ,
648- requestId : "request-456" ,
649- } ,
650- } ) ;
604+ throw failure ;
651605 } ) ;
652606
653- const caught = await core . runtime
654- . invokeRuntime (
607+ await expect (
608+ core . runtime . invokeRuntime (
655609 {
656610 runtimeId : "runtime-123" ,
657611 accountId : "123456789012" ,
@@ -660,14 +614,8 @@ test("IAM invoke failures include messages from modeled AWS service errors", asy
660614 contentType : "application/json" ,
661615 } ,
662616 { region : "us-east-1" } ,
663- )
664- . catch ( ( caught : Error ) => caught ) ;
665- const error = caught as Error ;
666-
667- expect ( error . message ) . toBe (
668- "Runtime invocation failed: Runtime session ID must contain at least 33 characters " +
669- "(ValidationException, HTTP 400, request ID request-456)" ,
670- ) ;
617+ ) ,
618+ ) . rejects . toBe ( failure ) ;
671619} ) ;
672620
673621test ( "CUSTOM_JWT invoke uses the generated endpoint and exact fetch request" , async ( ) => {
0 commit comments