@@ -864,6 +864,7 @@ void describe('AmplifyFunctionFactory', () => {
864864 void it ( 'sets valid durableConfig with executionTimeoutSeconds only' , ( ) => {
865865 const lambda = defineFunction ( {
866866 entry : './test-assets/default-lambda/handler.ts' ,
867+ runtime : 22 ,
867868 durableConfig : {
868869 executionTimeoutSeconds : 3600 , // 1 hour
869870 } ,
@@ -881,6 +882,7 @@ void describe('AmplifyFunctionFactory', () => {
881882 void it ( 'sets valid durableConfig with both executionTimeoutSeconds and retentionPeriodDays' , ( ) => {
882883 const lambda = defineFunction ( {
883884 entry : './test-assets/default-lambda/handler.ts' ,
885+ runtime : 22 ,
884886 durableConfig : {
885887 executionTimeoutSeconds : 86400 , // 1 day
886888 retentionPeriodDays : 30 ,
@@ -899,6 +901,7 @@ void describe('AmplifyFunctionFactory', () => {
899901 void it ( 'sets valid durableConfig with maximum values' , ( ) => {
900902 const lambda = defineFunction ( {
901903 entry : './test-assets/default-lambda/handler.ts' ,
904+ runtime : 22 ,
902905 durableConfig : {
903906 executionTimeoutSeconds : 31_622_400 , // 366 days
904907 retentionPeriodDays : 90 ,
@@ -917,6 +920,7 @@ void describe('AmplifyFunctionFactory', () => {
917920 void it ( 'sets valid durableConfig with minimum values' , ( ) => {
918921 const lambda = defineFunction ( {
919922 entry : './test-assets/default-lambda/handler.ts' ,
923+ runtime : 22 ,
920924 durableConfig : {
921925 executionTimeoutSeconds : 1 ,
922926 retentionPeriodDays : 1 ,
@@ -1043,6 +1047,39 @@ void describe('AmplifyFunctionFactory', () => {
10431047 DurableConfig : Match . absent ( ) ,
10441048 } ) ;
10451049 } ) ;
1050+
1051+ void it ( 'throws when durableConfig is used with runtime below 22' , ( ) => {
1052+ assert . throws (
1053+ ( ) =>
1054+ defineFunction ( {
1055+ entry : './test-assets/default-lambda/handler.ts' ,
1056+ runtime : 20 ,
1057+ durableConfig : {
1058+ executionTimeoutSeconds : 3600 ,
1059+ } ,
1060+ } ) . getInstance ( getInstanceProps ) ,
1061+ new AmplifyUserError ( 'UnsupportedDurableFunctionRuntimeError' , {
1062+ message : `Durable functions require runtime 22 or higher. Current runtime is 20.` ,
1063+ resolution : `Set the function runtime to 22 or higher to use durable functions.` ,
1064+ } ) ,
1065+ ) ;
1066+ } ) ;
1067+
1068+ void it ( 'throws when durableConfig is used with default runtime' , ( ) => {
1069+ assert . throws (
1070+ ( ) =>
1071+ defineFunction ( {
1072+ entry : './test-assets/default-lambda/handler.ts' ,
1073+ durableConfig : {
1074+ executionTimeoutSeconds : 3600 ,
1075+ } ,
1076+ } ) . getInstance ( getInstanceProps ) ,
1077+ new AmplifyUserError ( 'UnsupportedDurableFunctionRuntimeError' , {
1078+ message : `Durable functions require runtime 22 or higher. Current runtime is 20.` ,
1079+ resolution : `Set the function runtime to 22 or higher to use durable functions.` ,
1080+ } ) ,
1081+ ) ;
1082+ } ) ;
10461083 } ) ;
10471084
10481085 void describe ( 'provided function runtime property' , ( ) => {
0 commit comments