Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commands/plugin-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const addPluginToServerlessFile = async ({ configurationFilePath, pluginName })
schema: cloudformationSchema,
});
if (serverlessFileObj.plugins != null) {
// Plugins section can be behind veriables, opt-out in such case
// Plugins section can be behind variables, opt-out in such case
if (isPlainObject(serverlessFileObj.plugins)) {
if (
serverlessFileObj.plugins.modules != null &&
Expand Down
2 changes: 1 addition & 1 deletion docs/events/apigateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ functions:
- X-Amz-User-Agent
- X-Amzn-Trace-Id
allowCredentials: false
# Caches on browser and proxy for 10 minutes and doesnt allow proxy to serve out of date content
# Caches on browser and proxy for 10 minutes and doesn't allow proxy to serve out of date content
cacheControl: 'max-age=600, s-maxage=600, proxy-revalidate'
```

Expand Down
2 changes: 1 addition & 1 deletion docs/events/cloudfront.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ functions:
id: 658327ea-f89d-4fab-a63d-7e88639e58f6 # references AWS Managed Policy named Managed-CachingOptimized
```

It is also possible to reference policies with `behavior.CachePolicyId` property. When both `cachePolicy.id` and `behavior.CachePolicyId` are specified, setting from `cachePolicy.id` will be used. Similarily, when `cachePolicy.name` and `behavior.CachePolicyId` are specified, setting from `cachePolicy.name` will be used.
It is also possible to reference policies with `behavior.CachePolicyId` property. When both `cachePolicy.id` and `behavior.CachePolicyId` are specified, setting from `cachePolicy.id` will be used. Similarly, when `cachePolicy.name` and `behavior.CachePolicyId` are specified, setting from `cachePolicy.name` will be used.

```yml
functions:
Expand Down
2 changes: 1 addition & 1 deletion docs/events/event-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ functions:
- saas.external
```

### Re-using an existing event bus
### Reusing an existing event bus

If you want to reuse an existing event bus, you can define it with literal `arn` or with a reference to an existing event bus name via CF intrinsic functions. Referencing via intrinsic functions is available only if you use native CloudFormation support with `provider.eventBridge.useCloudFormation: true` setting:

Expand Down
2 changes: 1 addition & 1 deletion docs/events/s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ functions:

## Forcing deploying of triggers

An S3 bucket with triggers attached may not be correctly updated by AWS Cloudformation on subsequent deployments. To circumvent this issue you can use the `forceDeploy` flag which will try to force Cloudformation to update the triggers no matter what. This has to be used in conjuction with the `existing: true` flag.
An S3 bucket with triggers attached may not be correctly updated by AWS Cloudformation on subsequent deployments. To circumvent this issue you can use the `forceDeploy` flag which will try to force Cloudformation to update the triggers no matter what. This has to be used in conjunction with the `existing: true` flag.

```yml
functions:
Expand Down
2 changes: 1 addition & 1 deletion docs/events/sns.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ functions:

## Setting a redrive policy

This event definition creates an SNS topic that sends messages to a Dead Letter Queue (defined by its ARN) when the associated lambda is not available. In this example, messages that aren't delivered to the `dispatcher` Lambda (because the lambda service is down or irresponsive) will end in `myDLQ`.
This event definition creates an SNS topic that sends messages to a Dead Letter Queue (defined by its ARN) when the associated lambda is not available. In this example, messages that aren't delivered to the `dispatcher` Lambda (because the lambda service is down or unresponsive) will end in `myDLQ`.

```yml
functions:
Expand Down
2 changes: 1 addition & 1 deletion docs/events/websocket.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Websocket

[Websockets](https://www.w3.org/TR/websockets/) make it possible to add support for a bi-directional communication channel between clients and servers. Connection channels are kept alive and are re-used to exchange messages back-and-forth.
[Websockets](https://www.w3.org/TR/websockets/) make it possible to add support for a bi-directional communication channel between clients and servers. Connection channels are kept alive and are reused to exchange messages back-and-forth.

The Serverless Framework makes it possible to setup an [API Gateway powered](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-overview.html) Websocket backend with the help of the `websocket` event.

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/serverless.yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ functions:

### Kafka

[Kakfa events](../events/kafka.md):
[Kafka events](../events/kafka.md):

```yaml
functions:
Expand Down Expand Up @@ -1264,7 +1264,7 @@ functions:
pattern:
source:
- saas.external
# Re-use an existing event bus
# Reuse an existing event bus
- eventBridge:
eventBus: arn:aws:events:us-east-1:12345:event-bus/custom-private-events
pattern:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports.saveUser = async (event) => {
};
```

Now, the above class keeps business logic separate. Further, the code responsible for setting up dependencies, injecting them, calling business logic functions and interacting with AWS Lambda is in its own file, which will be changed less often. This way, the business logic is not provider dependent, easier to re-use, and easier to test.
Now, the above class keeps business logic separate. Further, the code responsible for setting up dependencies, injecting them, calling business logic functions and interacting with AWS Lambda is in its own file, which will be changed less often. This way, the business logic is not provider dependent, easier to reuse, and easier to test.

Further, this code doesn't require running any external services. Instead of real `db` and `mailer` services, we can pass mocks and assert that `db.saveUser` and `mailer.sendWelcomeEmail` have been called with the proper arguments.

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ In the above example you're setting a global schedule for all functions by refer

## Referencing Serverless Core Variables

Serverless initializes core variables which are used internally by the Framework itself. Those values are exposed via the Serverless Variables system and can be re-used with the `{sls:}` variable prefix.
Serverless initializes core variables which are used internally by the Framework itself. Those values are exposed via the Serverless Variables system and can be reused with the `{sls:}` variable prefix.

The following variables are available:

Expand Down
2 changes: 1 addition & 1 deletion lib/aws/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ let requestCounter = 0;
* @prop [service.name] - Name of the service to call, support subclasses
* @prop [service.params] - Parameters to apply when creating the service and doing the request
* @prop [service.params.credentials] - AWS Credentials to use
* @prop [service.params.useCache ] - Wether to reuse result of the same request cached locally
* @prop [service.params.useCache ] - Whether to reuse result of the same request cached locally
* @prop [service.params.region] - Region in which the call should be made (default to us-east-1)
* @prop [service.params.isS3TransferAccelerationEnabled] - Use s3 acceleration when available for the request
* @param {String} method - Method to call
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/config-schema-handler/resolve-ajv-validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const getValidate = async (schema) => {
code: { source: true },
});
require('ajv-formats').default(ajv);
// Ensure AJV related packages work well when there are mutliple AJV installations around
// Ensure AJV related packages work well when there are multiple AJV installations around
// See: https://github.com/ajv-validator/ajv/issues/1390#issuecomment-763138202
ajv.opts.code.formats = Ajv._`require("ajv-formats/dist/formats").fullFormats`;
ajv.addKeyword(require('./regexp-keyword'));
Expand Down
4 changes: 2 additions & 2 deletions lib/classes/plugin-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class PluginManager {
// Deny self overrides
if (command.startsWith(alias)) {
throw new ServerlessError(
`Command "${alias}" cannot be overriden by an alias`,
`Command "${alias}" cannot be overridden by an alias`,
'INVALID_COMMAND_ALIAS'
);
}
Expand Down Expand Up @@ -323,7 +323,7 @@ class PluginManager {
}, this)
) {
throw new ServerlessError(
`Command "${alias}" cannot be overriden by an alias`,
`Command "${alias}" cannot be overridden by an alias`,
'INVALID_COMMAND_ALIAS'
);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/classes/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Service {

loadServiceFileParam() {
// Not used internally, left set to not break plugins which depend on it
// TOOD: Remove with next major
// TODO: Remove with next major
this.serviceFilename = this.serverless.configurationFilename;

const configurationInput = this.serverless.configurationInput;
Expand All @@ -73,14 +73,14 @@ class Service {
// 3. In "run" phase: Instead of relying on `serverless.service` rely on
// `serverless.configuration` internally

// Below comments provide usage feedback helfpul for future refactor process.
// Below comments provide usage feedback helpful for future refactor process.

// ## Properties currently accessed at "initialization" phase

this.disabledDeprecations = configurationInput.disabledDeprecations;
this.deprecationNotificationMode = configurationInput.deprecationNotificationMode;

// `provider` (`provder.name` by many plugin constructs, and few other core properties as
// `provider` (`provider.name` by many plugin constructs, and few other core properties as
// `provider.stage` are read by dashboard plugin)
if (!isObject(configurationInput.provider)) {
const providerName = configurationInput.provider;
Expand Down Expand Up @@ -173,7 +173,7 @@ class Service {
);
}
if (!isObject(configurationInput.provider)) {
// Schema uncoditionally expects `provider` to be an object.
// Schema unconditionally expects `provider` to be an object.
// Ideally if it's fixed at some point, and either we do not support string notation for
// provider, or we support string by schema
configurationInput.provider = this.provider;
Expand Down
2 changes: 1 addition & 1 deletion lib/config-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const schema = {
type: 'array',
items: {
/*
* `anyOf` array by JSON schema spec cannot be empty, threfore we start
* `anyOf` array by JSON schema spec cannot be empty, therefore we start
* with one dummy item as workaround to ensure it validates against
* any undefined function events.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/configuration/variables/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class VariablesResolver {
// Resolve a single variable, which could be configured with multiple
// (first-choice, and fallback) sources

// Work on a copy, as with mulitple resolution batches, there's a rare possibility of same
// Work on a copy, as with multiple resolution batches, there's a rare possibility of same
// variable being resolved multiple times at once
const sources = Array.from(variableMeta.sources);
for (const source of sources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function create(event, context) {

let roleArn = `arn:${partition}:iam::${accountId}:role/serverlessApiGatewayCloudWatchRole`;
if (RoleArn) {
// if there's a roleArn in the Resource Properties, just re-use it here
// if there's a roleArn in the Resource Properties, just reuse it here
roleArn = RoleArn;
} else {
// Create an own API Gateway role if the roleArn was not set via Resource Properties
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/aws/package/compile/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ class AwsCompileFunctions {
if (functionObject.layers) {
functionResource.Properties.Layers = functionObject.layers;
} else if (this.serverless.service.provider.layers) {
// To avoid unwanted side effects ensure to not reference same array instace on each function
// To avoid unwanted side effects ensure to not reference same array instance on each function
functionResource.Properties.Layers = Array.from(this.serverless.service.provider.layers);
}

Expand Down
26 changes: 13 additions & 13 deletions lib/plugins/aws/utils/format-lambda-log-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ module.exports = (msgParam) => {
}

if (msg.startsWith('REPORT')) {
const splitted = msg.split('\t');
const duration = splitted[1];
const maxMemoryUsed = splitted[4].slice(4);
const initDuration = splitted[5] && splitted[5].split(':')[1];
const parts = msg.split('\t');
const duration = parts[1];
const maxMemoryUsed = parts[4].slice(4);
const initDuration = parts[5] && parts[5].split(':')[1];
// Simplify the output and trim out unnecessary information
if (initDuration) {
msg = `END ${duration} (init:${initDuration}) ${maxMemoryUsed}`;
Expand All @@ -32,22 +32,22 @@ module.exports = (msgParam) => {
return style.error(msg);
}

const splitted = msg.split('\t');
const parts = msg.split('\t');

if (splitted.length < 3) {
if (parts.length < 3) {
return msg;
}

let date;
let reqId;
let level = '';
if (!isNaN(new Date(splitted[0]).getTime())) {
date = splitted[0];
reqId = splitted[1];
} else if (!isNaN(new Date(splitted[1]).getTime())) {
date = splitted[1];
reqId = splitted[2];
level = `${splitted[0]}\t`;
if (!isNaN(new Date(parts[0]).getTime())) {
date = parts[0];
reqId = parts[1];
} else if (!isNaN(new Date(parts[1]).getTime())) {
date = parts[1];
reqId = parts[2];
level = `${parts[0]}\t`;
} else {
return msg;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class Serverless {
// make sure the command exists before doing anything else
this.pluginManager.validateCommand(this.processedInput.commands);

// Some plugins acccess `options` through `this.variables`
// Some plugins access `options` through `this.variables`
this.variables.options = this.pluginManager.cliOptions;

if (this.processedInput.commands[0] !== 'plugin') {
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/download-template-from-repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ async function parseRepoURL(inputUrl) {
}

const msg =
'The URL you passed is not one of the valid providers: "GitHub", "GitHub Entreprise", "Bitbucket", "Bitbucket Server" or "GitLab".';
'The URL you passed is not one of the valid providers: "GitHub", "GitHub Enterprise", "Bitbucket", "Bitbucket Server" or "GitLab".';
const err = new ServerlessError(msg, 'INVALID_TEMPLATE_PROVIDER');
// test if it's a private bitbucket server
return retrieveBitbucketServerInfo(url)
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/serverless-utils/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports.writeText = getOutputReporter('serverless').get('text');

module.exports.progress = getProgressReporter('serverless');
// Method intended to clear and close indefinitely any progress writing
// Overriden with intended logic in reporter
// Overridden with intended logic in reporter
module.exports.progress.clear = () => {};

module.exports.getPluginWriters = memoizee(
Expand Down
8 changes: 4 additions & 4 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# How to run, organize and write tests?

As framework deals with significant technical debt baggage many of currently configured tests do not
resemble practise we want to follow in newly introduced tests.
resemble practice we want to follow in newly introduced tests.

Please follow this document as the only guideline, it also provides links to tests that serve as a good example to replicate

Expand All @@ -13,7 +13,7 @@ Tests are configured with [Mocha](https://mochajs.org/) test framework, and can
npm test
```

All new tests should be configured with help of [runServerless](./utils/run-serverless.js) util - it's the only way to test functionality against completely intialized `serverless` instance, and it's the only scenario that reflects real world usage.
All new tests should be configured with help of [runServerless](./utils/run-serverless.js) util - it's the only way to test functionality against completely initialized `serverless` instance, and it's the only scenario that reflects real world usage.

The `runServerless` util (inlined from @serverless/test) is configured at `./utils/run-serverless.js` and supports two additional options (`fixture` and `configExt`), which provides out of a box setup to run _Serverless_ instance against prepared fixture with eventually extended service configuration

Expand All @@ -24,7 +24,7 @@ When creating a new test, it is an established practice to name the top-level de
### Existing test examples:

- [Run against config passed inline](https://github.com/serverless/serverless/blob/73107822945a878abbdebe2309e8e9d87cc2858a/lib/plugins/aws/package/lib/generateCoreTemplate.test.js#L11-L14)
- [Run against preprepared fixture](https://github.com/serverless/serverless/blob/74634c3317a116077a008375e20d6a5b99b1256e/lib/plugins/aws/package/compile/functions/index.test.js#L2605-L2608)
- [Run against pre-prepared fixture](https://github.com/serverless/serverless/blob/74634c3317a116077a008375e20d6a5b99b1256e/lib/plugins/aws/package/compile/functions/index.test.js#L2605-L2608)
- Fixtures can be [extended](https://github.com/serverless/serverless/blob/74634c3317a116077a008375e20d6a5b99b1256e/lib/plugins/aws/package/compile/events/httpApi/index.test.js#L95-L99) on spot. Whenever possible it's better to extend existing fixture (e.g. basic `function`) instead of creating new one (check [ALB health check tests](https://github.com/serverless/serverless/blob/80e70e7affd54418361c4d54bdef1561af6b8826/lib/plugins/aws/package/compile/events/alb/lib/healthCheck.test.js) for good example on such approach)
- If needed introduce new test fixtures at [test/fixtures](./fixtures)

Expand Down Expand Up @@ -64,7 +64,7 @@ AWS_ACCESS_KEY_ID=XXX AWS_SECRET_ACCESS_KEY=xxx npx mocha test/integration/{chos

Due to the fact that some of the tests require a bit more complex infrastructure setup which might be lengthy, two additional commands has been made available:

- `integration-test-setup` - used for setting up all needed intrastructure dependencies
- `integration-test-setup` - used for setting up all needed infrastructure dependencies
- `integration-test-teardown` - used for tearing down the infrastructure setup by the above command

Such tests take advantage of `isDependencyStackAvailable` util to check if all needed dependencies are ready. If not, it skips the given test suite.
Expand Down
Loading