@swydo/byol 3.0.310 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 3.1.1 (2025-01-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **byol:** convert timeout to ms ([02e6a7a](https://github.com/Swydo/byol/commit/02e6a7a89a823deb911bff9defe996549f6aea6b))
12
+
13
+
14
+
15
+
16
+
17
+ # 3.1.0 (2025-01-10)
18
+
19
+
20
+ ### Features
21
+
22
+ * **byol:** base getRemainingTimeInMillis of timeout specified in template ([#918](https://github.com/Swydo/byol/issues/918)) ([43c8113](https://github.com/Swydo/byol/commit/43c81136c882976986246bddd4ac52825fa277c5))
23
+
24
+
25
+
26
+
27
+
6
28
  ## 3.0.310 (2024-12-06)
7
29
 
8
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swydo/byol",
3
- "version": "3.0.310",
3
+ "version": "3.1.1",
4
4
  "description": "Bring Your Own Lambda",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -27,5 +27,5 @@
27
27
  "peerDependencies": {
28
28
  "aws-xray-sdk-core": "^3.0.0"
29
29
  },
30
- "gitHead": "83dcb72347a2824464c6f508e66130a4698e9d78"
30
+ "gitHead": "02e6a7a89a823deb911bff9defe996549f6aea6b"
31
31
  }
@@ -72,6 +72,7 @@ async function executeWithXRay(segmentName, handler, event, awsContext) {
72
72
  async function callHandler({
73
73
  indexPath,
74
74
  handlerName,
75
+ timeOut,
75
76
  event,
76
77
  environment,
77
78
  }) {
@@ -80,12 +81,12 @@ async function callHandler({
80
81
  const absoluteIndexPath = path.join(process.cwd(), indexPath);
81
82
 
82
83
  const { [handlerName]: handler } = await import(absoluteIndexPath);
84
+ const executionTimeOut = new Date().getTime() + (timeOut * 1000);
85
+
83
86
  const awsContext = {
84
87
  awsRequestId: generateRequestId(),
85
88
  getRemainingTimeInMillis() {
86
- // Max signed 32-bit int is upper value of setTimeout. Using that as magic value since normally byols
87
- // don't have a timeout
88
- return 2 ** 31 - 2;
89
+ return executionTimeOut - new Date().getTime();
89
90
  },
90
91
  };
91
92
 
@@ -64,6 +64,7 @@ async function invokeFunction(functionName, event, {
64
64
  Properties: {
65
65
  Handler: handler,
66
66
  CodeUri: codeUri = '.',
67
+ Timeout: timeOut,
67
68
  },
68
69
  } = resource;
69
70
 
@@ -76,6 +77,7 @@ async function invokeFunction(functionName, event, {
76
77
  indexPath,
77
78
  debugPortStart,
78
79
  handlerName,
80
+ timeOut,
79
81
  environment,
80
82
  event,
81
83
  keepAlive,
@@ -10,6 +10,7 @@ async function invokeHandler({
10
10
  debugPortStart,
11
11
  indexPath,
12
12
  handlerName,
13
+ timeOut,
13
14
  environment,
14
15
  event,
15
16
  keepAlive = false,
@@ -33,6 +34,7 @@ async function invokeHandler({
33
34
  const result = await workerPool.exec('callHandler', [{
34
35
  indexPath,
35
36
  handlerName,
37
+ timeOut,
36
38
  event,
37
39
  environment: {
38
40
  ...process.env,