-
-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for serverless v4 and typescript (#1806)
* feat: add support for serverless v4 and typescript * ci: fix unit tests with new serverless version * test: remove tests for deprecated plugins * test: fix serverless path * test: add typescript module test * feat: add support for python 3.12 * chore: remove docker-serverless test * test: restore plugin tests with serverless esbuild disabled * chore: move docker-in-docker folder * ci: fix tests on windows * ci: add timeout for jobs * ci: fix teardown * fix: use wpathToFileURL to fix windows imports * test: move teardown to afterEach function * test: fill empty test descriptions
- Loading branch information
1 parent
31afde0
commit b983ceb
Showing
60 changed files
with
32,821 additions
and
93,532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
/coverage | ||
/src/lambda/handler-runner/in-process-runner/aws-lambda-ric/UserFunction.js | ||
/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/lambda/handler-runner/in-process-runner/aws-lambda-ric/Errors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* eslint-disable max-classes-per-file */ | ||
/** | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* This code was copied from: | ||
* https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/main/src/Errors.js | ||
* | ||
* Defines custom error types throwable by the runtime. | ||
*/ | ||
|
||
"use strict" | ||
|
||
const errorClasses = [ | ||
class ImportModuleError extends Error {}, | ||
class HandlerNotFound extends Error {}, | ||
class MalformedHandlerName extends Error {}, | ||
class UserCodeSyntaxError extends Error {}, | ||
class MalformedStreamingHandler extends Error {}, | ||
class InvalidStreamingOperation extends Error {}, | ||
class UnhandledPromiseRejection extends Error { | ||
constructor(reason, promise) { | ||
super(reason) | ||
this.reason = reason | ||
this.promise = promise | ||
} | ||
}, | ||
] | ||
|
||
errorClasses.forEach((e) => { | ||
module.exports[e.name] = e | ||
e.prototype.name = `Runtime.${e.name}` | ||
}) |
38 changes: 38 additions & 0 deletions
38
src/lambda/handler-runner/in-process-runner/aws-lambda-ric/HttpResponseStream.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* eslint-disable no-underscore-dangle */ | ||
/* eslint-disable no-param-reassign */ | ||
/** | ||
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* This code was copied from: | ||
* https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/main/src/HttpResponseStream.js | ||
* | ||
* HttpResponseStream is NOT used by the runtime. | ||
* It is only exposed in the `awslambda` variable for customers to use. | ||
*/ | ||
|
||
"use strict" | ||
|
||
const METADATA_PRELUDE_CONTENT_TYPE = | ||
"application/vnd.awslambda.http-integration-response" | ||
const DELIMITER_LEN = 8 | ||
|
||
// Implements the application/vnd.awslambda.http-integration-response content type. | ||
class HttpResponseStream { | ||
static from(underlyingStream, prelude) { | ||
underlyingStream.setContentType(METADATA_PRELUDE_CONTENT_TYPE) | ||
|
||
// JSON.stringify is required. NULL byte is not allowed in metadataPrelude. | ||
const metadataPrelude = JSON.stringify(prelude) | ||
|
||
underlyingStream._onBeforeFirstWrite = (write) => { | ||
write(metadataPrelude) | ||
|
||
// Write 8 null bytes after the JSON prelude. | ||
write(new Uint8Array(DELIMITER_LEN)) | ||
} | ||
|
||
return underlyingStream | ||
} | ||
} | ||
|
||
module.exports.HttpResponseStream = HttpResponseStream |
Oops, something went wrong.