serverless-offline 10.3.2 → 11.0.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
@@ -108,13 +108,6 @@ to list all the options for the plugin run:
108
108
 
109
109
  All CLI options are optional:
110
110
 
111
- #### apiKey
112
-
113
- _This option is deprecated and will be removed in the next major version. If you want to specify the apiKey value yourself, please define it under 'provider.apiGateway.apiKeys' in the serverless config._
114
-
115
- Defines the API key value to be used for endpoints marked as private.<br />
116
- Defaults to a random value.
117
-
118
111
  #### corsAllowHeaders
119
112
 
120
113
  Used as default Access-Control-Allow-Headers header value for responses. Delimit multiple values with commas.<br />
@@ -139,12 +132,6 @@ Default: 'WWW-Authenticate,Server-Authorization'
139
132
 
140
133
  Used to disable cookie-validation on hapi.js-server.
141
134
 
142
- #### disableScheduledEvents
143
-
144
- _This option is deprecated and will be removed in the next major version. If you want to disable the event, please define it in the 'events.schedule.enabled' section of the serverless config._
145
-
146
- Disables all scheduled events. Overrides configurations in serverless.yml.
147
-
148
135
  #### dockerHost
149
136
 
150
137
  The host name of Docker.<br />
@@ -183,7 +170,7 @@ Default: 3000
183
170
 
184
171
  #### ignoreJWTSignature
185
172
 
186
- When using HttpApi with a JWT authorizer, don't check the signature of the JWT token. This should only be used for local development.
173
+ When using HttpApi with a JWT authorizer, don't check the signature of the JWT token.
187
174
 
188
175
  #### lambdaPort
189
176
 
@@ -484,7 +471,7 @@ By default layers are downloaded on a per-project basis, however, if you want to
484
471
 
485
472
  As defined in the [Serverless Documentation](https://serverless.com/framework/docs/providers/aws/events/apigateway/#setting-api-keys-for-your-rest-api) you can use API Keys as a simple authentication method.
486
473
 
487
- Serverless-offline will emulate the behaviour of APIG and create a random token that's printed on the screen. With this token you can access your private methods adding `x-api-key: generatedToken` to your request header. All api keys will share the same token. To specify a custom token use the `--apiKey` cli option.
474
+ Serverless-offline will emulate the behaviour of APIG and create a random token that's printed on the screen. With this token you can access your private methods adding `x-api-key: generatedToken` to your request header. All api keys will share the same token.
488
475
 
489
476
  ### Custom authorizers
490
477
 
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": "10.3.2",
4
+ "version": "11.0.1",
5
5
  "description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -86,13 +86,13 @@
86
86
  "@hapi/h2o2": "^10.0.0",
87
87
  "@hapi/hapi": "^20.2.2",
88
88
  "@serverless/utils": "^6.7.0",
89
- "aws-sdk": "^2.1224.0",
89
+ "aws-sdk": "^2.1225.0",
90
90
  "boxen": "^7.0.0",
91
91
  "chalk": "^5.0.1",
92
92
  "execa": "^6.1.0",
93
93
  "fs-extra": "^10.1.0",
94
94
  "java-invoke-local": "0.0.6",
95
- "jose": "^4.9.3",
95
+ "jose": "^4.10.0",
96
96
  "js-string-escape": "^1.0.1",
97
97
  "jsonpath-plus": "^7.2.0",
98
98
  "jsonschema": "^1.4.1",
@@ -6,7 +6,7 @@ import {
6
6
  defaultOptions,
7
7
  SERVER_SHUTDOWN_TIMEOUT,
8
8
  } from './config/index.js'
9
- import { gray, orange } from './config/colors.js'
9
+ import { gray } from './config/colors.js'
10
10
 
11
11
  export default class ServerlessOffline {
12
12
  #cliOptions = null
@@ -61,16 +61,6 @@ export default class ServerlessOffline {
61
61
  async start() {
62
62
  this.#mergeOptions()
63
63
 
64
- if (this.#options.disableScheduledEvents) {
65
- log.notice()
66
- log.warning(
67
- orange(`'--disableScheduledEvents' is deprecated and will be removed in the next major version.
68
- Please disable the event in the 'events.schedule.enabled' section of the serverless config.
69
- If you are experiencing any issues please let us know: https://github.com/dherault/serverless-offline/issues`),
70
- )
71
- log.notice()
72
- }
73
-
74
64
  const { httpEvents, lambdas, scheduleEvents, webSocketEvents } =
75
65
  this.#getEvents()
76
66
 
@@ -84,7 +74,7 @@ If you are experiencing any issues please let us know: https://github.com/dherau
84
74
  eventModules.push(this.#createHttp(httpEvents))
85
75
  }
86
76
 
87
- if (!this.#options.disableScheduledEvents && scheduleEvents.length > 0) {
77
+ if (scheduleEvents.length > 0) {
88
78
  eventModules.push(this.#createSchedule(scheduleEvents))
89
79
  }
90
80
 
@@ -1,9 +1,4 @@
1
1
  export default {
2
- apiKey: {
3
- type: 'string',
4
- usage:
5
- '[This option is deprecated] Defines the API key value to be used for endpoints marked as private. Defaults to a random hash.',
6
- },
7
2
  corsAllowHeaders: {
8
3
  type: 'string',
9
4
  usage:
@@ -28,11 +23,6 @@ export default {
28
23
  type: 'boolean',
29
24
  usage: 'Used to disable cookie-validation on hapi.js-server.',
30
25
  },
31
- disableScheduledEvents: {
32
- type: 'boolean',
33
- usage:
34
- '[This option is deprecated] Disables all scheduled events. Overrides configurations in serverless.yml. Default: false.',
35
- },
36
26
  dockerHost: {
37
27
  type: 'string',
38
28
  usage: 'The host name of Docker. Default: localhost.',
@@ -72,7 +62,7 @@ export default {
72
62
  ignoreJWTSignature: {
73
63
  type: 'boolean',
74
64
  usage:
75
- "When using HttpApi with a JWT authorizer, don't check the signature of the JWT token. This should only be used for local development.",
65
+ "When using HttpApi with a JWT authorizer, don't check the signature of the JWT token.",
76
66
  },
77
67
  lambdaPort: {
78
68
  type: 'string',
@@ -1,11 +1,9 @@
1
1
  export default {
2
- apiKey: null,
3
2
  corsAllowHeaders: 'accept,content-type,x-api-key,authorization',
4
3
  corsAllowOrigin: '*',
5
4
  corsDisallowCredentials: true,
6
5
  corsExposedHeaders: 'WWW-Authenticate,Server-Authorization',
7
6
  disableCookieValidation: false,
8
- disableScheduledEvents: false,
9
7
  dockerHost: 'localhost',
10
8
  dockerHostServicePath: null,
11
9
  dockerNetwork: null,
@@ -20,7 +20,6 @@ import {
20
20
  import LambdaProxyIntegrationEventV2 from './lambda-events/LambdaProxyIntegrationEventV2.js'
21
21
  import parseResources from './parseResources.js'
22
22
  import payloadSchemaValidator from './payloadSchemaValidator.js'
23
- import { orange } from '../../config/colors.js'
24
23
  import logRoutes from '../../utils/logRoutes.js'
25
24
  import {
26
25
  createApiKey,
@@ -895,16 +894,6 @@ export default class HttpServer {
895
894
  if (!this.#hasPrivateHttpEvent && httpEvent.private) {
896
895
  this.#hasPrivateHttpEvent = true
897
896
 
898
- if (this.#options.apiKey) {
899
- log.notice()
900
- log.warning(
901
- orange(`'--apiKey' is deprecated and will be removed in the next major version.
902
- Please define the apiKey value in the 'provider.apiGateway.apiKeys' section of the serverless config.
903
- If you are experiencing any issues please let us know: https://github.com/dherault/serverless-offline/issues`),
904
- )
905
- log.notice()
906
- }
907
-
908
897
  if (this.#options.noAuth) {
909
898
  log.notice(
910
899
  `Authorizers are turned off. You do not need to use 'x-api-key' header.`,
@@ -914,15 +903,17 @@ export default class HttpServer {
914
903
  }
915
904
 
916
905
  if (this.#apiKeysValues == null) {
917
- const apiKey = this.#options.apiKey ?? createApiKey()
918
-
919
- log.notice(`Key with token: ${apiKey}`)
920
-
921
906
  this.#apiKeysValues = getApiKeysValues(
922
907
  this.#serverless.service.provider.apiGateway?.apiKeys ?? [],
923
908
  )
924
909
 
925
- this.#apiKeysValues.add(apiKey)
910
+ if (this.#apiKeysValues.size === 0) {
911
+ const apiKey = createApiKey()
912
+
913
+ this.#apiKeysValues.add(apiKey)
914
+
915
+ log.notice(`Key with token: ${apiKey}`)
916
+ }
926
917
  }
927
918
  }
928
919