serverless-offline 13.0.0 → 13.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/README.md CHANGED
@@ -38,12 +38,6 @@ To do so, it starts an HTTP server that handles the request's lifecycle like API
38
38
 
39
39
  This plugin is updated by its users, I just do maintenance and ensure that PRs are relevant to the community. In other words, if you [find a bug or want a new feature](https://github.com/dherault/serverless-offline/issues), please help us by becoming one of the [contributors](https://github.com/dherault/serverless-offline/graphs/contributors) :v: ! See the [contributing section](#contributing).
40
40
 
41
- ## Looking for maintainers ⚠️
42
-
43
- Applications welcome! This package is used by thousands of people daily. Yet we lack a maintainer! If you think you'll be a good fit for the role, please send me an email at dherault/at/gmail.com.
44
-
45
- See https://github.com/dherault/serverless-offline/issues/1704.
46
-
47
41
  ## Documentation
48
42
 
49
43
  - [Installation](#installation)
@@ -530,9 +524,16 @@ only enabled with the `--ignoreJWTSignature` flag. Make sure to only set this fl
530
524
 
531
525
  ### Serverless plugin authorizers
532
526
 
533
- If your authentication needs are custom and not satisfied by the existing capabilities of the Serverless offline project, you can inject your own authentication strategy. To inject a custom strategy for Lambda invocation, you define a custom variable under `serverless-offline` called `authenticationProvider` in the serverless.yml file. The value of the custom variable will be used to `require(your authenticationProvider value)` where the location is expected to return a function with the following signature.
527
+ If your authentication needs are custom and not satisfied by the existing capabilities of the Serverless offline project, you can inject your own authentication strategy. To inject a custom strategy for Lambda invocation, you define a custom variable under `offline` called `customAuthenticationProvider` in the serverless.yml file. The value of the custom variable will be used to `require(your customAuthenticationProvider value)` where the location is expected to return a function with the following signature.
528
+
529
+ ```yaml
530
+ offline:
531
+ customAuthenticationProvider: ./path/to/custom-authentication-provider
532
+ ```
534
533
 
535
534
  ```js
535
+ // ./path/to/customer-authentication-provider.js
536
+
536
537
  module.exports = function (endpoint, functionKey, method, path) {
537
538
  return {
538
539
  getAuthenticateFunction() {
@@ -549,7 +550,7 @@ module.exports = function (endpoint, functionKey, method, path) {
549
550
  }
550
551
  ```
551
552
 
552
- A working example of injecting a custom authorization provider can be found in the projects integration tests under the folder `custom-authentication`.
553
+ A working example of injecting a custom authorization provider can be found in the projects integration tests under the folder [`custom-authentication`](./tests/integration/custom-authentication).
553
554
 
554
555
  ## Custom headers
555
556
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dedicatedTo": "Blue, a great migrating bird.",
3
3
  "name": "serverless-offline",
4
- "version": "13.0.0",
4
+ "version": "13.1.1",
5
5
  "description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -18,6 +18,7 @@
18
18
  "prepare-release": "standard-version && prettier --write CHANGELOG.md",
19
19
  "prepublishOnly": "npm run lint",
20
20
  "prettier": "prettier --check .",
21
+ "prettier:fix": "prettier --write .",
21
22
  "prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
22
23
  "prettier-check:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
23
24
  "prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
@@ -78,7 +79,7 @@
78
79
  ]
79
80
  },
80
81
  "dependencies": {
81
- "@aws-sdk/client-lambda": "^3.414.0",
82
+ "@aws-sdk/client-lambda": "^3.418.0",
82
83
  "@hapi/boom": "^10.0.1",
83
84
  "@hapi/h2o2": "^10.0.4",
84
85
  "@hapi/hapi": "^21.3.2",
@@ -89,7 +90,7 @@
89
90
  "desm": "^1.3.0",
90
91
  "execa": "^8.0.1",
91
92
  "fs-extra": "^11.1.1",
92
- "is-wsl": "^3.0.0",
93
+ "is-wsl": "^3.1.0",
93
94
  "java-invoke-local": "0.0.6",
94
95
  "jose": "^4.14.6",
95
96
  "js-string-escape": "^1.0.1",
@@ -99,14 +100,14 @@
99
100
  "luxon": "^3.2.0",
100
101
  "node-schedule": "^2.1.1",
101
102
  "p-memoize": "^7.1.1",
102
- "p-retry": "^6.0.0",
103
+ "p-retry": "^6.1.0",
103
104
  "velocityjs": "^2.0.6",
104
105
  "ws": "^8.14.2"
105
106
  },
106
107
  "devDependencies": {
107
108
  "@istanbuljs/esm-loader-hook": "^0.2.0",
108
109
  "archiver": "^6.0.1",
109
- "eslint": "^8.49.0",
110
+ "eslint": "^8.50.0",
110
111
  "eslint-config-airbnb-base": "^15.0.0",
111
112
  "eslint-config-prettier": "^9.0.0",
112
113
  "eslint-plugin-import": "^2.28.1",
@@ -292,7 +292,11 @@ export default class HttpServer {
292
292
  }
293
293
 
294
294
  createRoutes(functionKey, albEvent) {
295
- const method = albEvent.conditions.method[0].toUpperCase()
295
+ let method = 'ANY'
296
+ if ((albEvent.conditions.method || []).length > 0) {
297
+ method = albEvent.conditions.method[0].toUpperCase()
298
+ }
299
+
296
300
  const path = albEvent.conditions.path[0]
297
301
  const hapiPath = generateAlbHapiPath(path, this.#options, this.#serverless)
298
302
 
@@ -276,7 +276,8 @@ export default function createAuthScheme(authorizerOptions, provider, lambda) {
276
276
  authorizerOptions.type !== 'request' ||
277
277
  authorizerOptions.identitySource
278
278
  ) {
279
- const headerRegExp = /^(method.|\$)request.header.((?:\w+-?)+\w+)$/
279
+ // Only validate the first of N possible headers.
280
+ const headerRegExp = /^(method.|\$)request.header.((?:\w+-?)+\w+).*$/
280
281
  const queryStringRegExp =
281
282
  /^(method.|\$)request.querystring.((?:\w+-?)+\w+)$/
282
283