Skip to content

Commit 450f395

Browse files
author
sw-yx
committed
2 parents 9321479 + 879211d commit 450f395

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ The goal is to make it easy to write Lambda's with transpiled JS/TypeScript feat
88

99
Netlify-Lambda uses webpack to bundle up your functions and their dependencies for you, however this is not the only approach. If you have native node modules (or other dependencies that dont expect to be bundled like [the Firebase SDK](https://github.com/netlify/netlify-lambda/issues/112)) then you may want to try the zipping approach.
1010

11-
We have recently soft released a new library to do this for you: https://github.com/netlify/zip-it-and-ship-it. This is integrated into the Netlify CLI. There is [more documentation here](https://www.netlify.com/docs/cli/#unbundled-javascript-function-deploys) in the official CLI docs and support is available through [our regular channels](https://www.netlify.com/support/).
11+
We have recently integrated this functionality ([zip-it-and-ship-it](https://github.com/netlify/zip-it-and-ship-it)) into the Netlify CLI. Check the [documentation here](https://www.netlify.com/docs/cli/#unbundled-javascript-function-deploys) in the official CLI docs and support is available through [our regular channels](https://www.netlify.com/support/). The current drawback of this approach is no ability to serve these zipped functions locally, although we are working on this.
1212

1313
<details>
14-
<summary><b>DIY zipping</b></summary>
14+
<summary><b>A bit information on manual zipping</b></summary>
1515

16-
Read [here](https://www.netlify.com/blog/2018/09/14/forms-and-functions/) and [here for instructions](https://github.com/DavidWells/function-zips/) (more examples [here](https://github.com/netlify/function-bundling-example))
16+
You can still zip up and deploy functions by yourself, as has always been the case with Netlify Functions. Read [here](https://www.netlify.com/blog/2018/09/14/forms-and-functions/) and [here for instructions](https://github.com/DavidWells/function-zips/) (more examples [here](https://github.com/netlify/function-bundling-example))
1717
</details>
1818

1919
Look out for more announcements on this in coming months.

lib/serve.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,20 @@ function createHandler(dir, static, timeout) {
135135
{ clientContext: buildClientContext(request.headers) || {} },
136136
callback
137137
);
138+
139+
var invocationTimeoutRef = null
140+
138141
Promise.race([
139142
promiseCallback(promise, callback),
140-
setTimeout(function() {
141-
handleInvocationTimeout(response, timeout)
142-
}, timeout * 1000)
143-
])
143+
new Promise(function(resolve) {
144+
invocationTimeoutRef = setTimeout(function() {
145+
handleInvocationTimeout(response, timeout)
146+
resolve()
147+
}, timeout * 1000)
148+
})
149+
]).finally(() => {
150+
clearTimeout(invocationTimeoutRef)
151+
})
144152
};
145153
}
146154

0 commit comments

Comments
 (0)