Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit 21c53d9

Browse files
authored
Merge branch 'master' into dphang/locale-domain-redirects
2 parents 0b94cc3 + 99d0b56 commit 21c53d9

File tree

1,295 files changed

+27434
-199430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,295 files changed

+27434
-199430
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ updates:
2222
- dependency-name: "@aws-cdk/*"
2323
# FIXME: some issue with fs-extra for some users? https://github.com/serverless-nextjs/serverless-next.js/issues/1240
2424
- dependency-name: "fs-extra"
25+
- dependency-name: "sharp" # This is manually built for Lambda Node.js 14.x runtime
2526
open-pull-requests-limit: 10
2627

2728
- package-ecosystem: "github-actions"

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,40 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [3.2.0-alpha.6](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.5...v3.2.0-alpha.6) (2021-06-27)
7+
8+
**Note:** Version bump only for package serverless-nextjs-monorepo
9+
10+
# [3.2.0-alpha.5](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.4...v3.2.0-alpha.5) (2021-06-27)
11+
12+
**Note:** Version bump only for package serverless-nextjs-monorepo
13+
14+
# [3.2.0-alpha.4](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.3...v3.2.0-alpha.4) (2021-06-27)
15+
16+
### Bug Fixes
17+
18+
- update aws retry logic and fix dependencies ([#1306](https://github.com/serverless-nextjs/serverless-next.js/issues/1306)) ([e0cee9c](https://github.com/serverless-nextjs/serverless-next.js/commit/e0cee9c0d5d79314a7239c37e55438b5200d8bb2))
19+
20+
# [3.2.0-alpha.3](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.2...v3.2.0-alpha.3) (2021-06-27)
21+
22+
**Note:** Version bump only for package serverless-nextjs-monorepo
23+
24+
# [3.2.0-alpha.2](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.1...v3.2.0-alpha.2) (2021-06-26)
25+
26+
**Note:** Version bump only for package serverless-nextjs-monorepo
27+
28+
# [3.2.0-alpha.1](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.0...v3.2.0-alpha.1) (2021-06-26)
29+
30+
### Features
31+
32+
- **nextjs-component:** update default runtime to nodejs14.x ([#1301](https://github.com/serverless-nextjs/serverless-next.js/issues/1301)) ([52b902f](https://github.com/serverless-nextjs/serverless-next.js/commit/52b902f6035992d14ddd05195ffa1f35505bc7d6))
33+
34+
# [3.2.0-alpha.0](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.1.1-alpha.0...v3.2.0-alpha.0) (2021-06-26)
35+
36+
### Features
37+
38+
- **nextjs-component, aws-lambda:** support adding tags to lambdas ([#1300](https://github.com/serverless-nextjs/serverless-next.js/issues/1300)) ([74721c2](https://github.com/serverless-nextjs/serverless-next.js/commit/74721c28097ec3bb4227ad50e9d9c3db48848fb8))
39+
640
## [3.1.1-alpha.0](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.1.0...v3.1.1-alpha.0) (2021-06-26)
741

842
### Bug Fixes

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Is there a feature that you want but is not yet supported? Please open a [new is
8787
- [x] [Custom Headers](https://nextjs.org/docs/api-reference/next.config.js/headers). Caveats: every route should be able to have custom headers except `_next/static/*` and `static/*`, since those cache behaviors do not have Lambda handlers attached to them. You also need to specify the S3 key as the source when redirecting any path mapped to an S3 file (see [PR](https://github.com/serverless-nextjs/serverless-next.js/pull/662) for more details).
8888
- [x] [Image Optimization](https://nextjs.org/docs/basic-features/image-optimization) Available in the latest 1.19 alpha version. Please try it out and let us know if there are any bugs.
8989
- [x] [Next.js 10 Localization](https://nextjs.org/blog/next-10). See: https://github.com/serverless-nextjs/serverless-next.js/issues/721 for more details and tips.
90-
- [x] [Incremental Static Regeneration](https://nextjs.org/docs/basic-features/data-fetching#incremental-static-regeneration). Requires SQS.SendMessage permissions on your Lambda role and various SQS/Lambda permissions (to be documented) on your deployment user. See https://github.com/serverless-nextjs/serverless-next.js/pull/1028 for more details, big thanks to @kirkness for this amazing work. **Available in latest alpha version only. Please try out and help report any issues!**
90+
- [x] [Incremental Static Regeneration](https://nextjs.org/docs/basic-features/data-fetching#incremental-static-regeneration). Requires SQS.SendMessage permissions on your Lambda role and various SQS/Lambda permissions (to be documented) on your deployment user. See https://github.com/serverless-nextjs/serverless-next.js/pull/1028 for more details, big thanks to @kirkness for this amazing work.
9191

9292
### Getting started
9393

@@ -377,6 +377,9 @@ The exhaustive list of AWS actions required for a deployment:
377377
"lambda:PublishVersion",
378378
"lambda:UpdateFunctionCode",
379379
"lambda:UpdateFunctionConfiguration",
380+
"lambda:ListTags", // for tagging lambdas
381+
"lambda:TagResource", // for tagging lambdas
382+
"lambda:UntagResource", // for tagging lambdas
380383
"route53:ChangeResourceRecordSets", // only for custom domains
381384
"route53:ListHostedZonesByName",
382385
"route53:ListResourceRecordSets", // only for custom domains
@@ -424,7 +427,7 @@ myNextApplication:
424427
imageLambda: 2048
425428
```
426429

427-
The same pattern can be followed for specifying the Node.js runtime (nodejs12.x by default):
430+
The same pattern can be followed for specifying the Node.js runtime (nodejs14.x by default):
428431

429432
```yml
430433
# serverless.yml
@@ -433,9 +436,9 @@ myNextApplication:
433436
component: "@sls-next/serverless-component@{version_here}"
434437
inputs:
435438
runtime:
436-
defaultLambda: "nodejs10.x"
437-
apiLambda: "nodejs10.x"
438-
imageLambda: "nodejs12.x" # Note that the sharp image library is built for NodeJS 12.x
439+
defaultLambda: "nodejs14.x"
440+
apiLambda: "nodejs14.x"
441+
imageLambda: "nodejs14.x" # Note that the sharp image library is built for Lambda Node.js 14.x, although it will likely work fine on other runtimes
439442
```
440443

441444
Similarly, the timeout by default is 10 seconds. To customise you can:
@@ -468,6 +471,8 @@ myNextApplication:
468471
imageLambda: fooImageLambda
469472
```
470473

474+
There is a fourth **regeneration** lambda, which can be configured similarly and is used for Incremental Static Regeneration. However, it does not use Lamda@Edge and can, for example, have a longer timeout setting.
475+
471476
### Architecture
472477

473478
![architecture](./img/arch_no_grid.png)
@@ -501,8 +506,9 @@ The fourth cache behaviour handles next API requests `api/*`.
501506
| description | `string` | `*lambda-type*@Edge for Next CloudFront distribution` | The description that will be used for both lambdas. Note that "(API)" will be appended to the API lambda description. |
502507
| policy | `string\|object` | `arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole` | The arn or inline policy that will be assigned to both lambdas. |
503508
| roleArn | `string\|object` | null | The arn of role that will be assigned to both lambdas. |
504-
| runtime | `string\|object` | `nodejs12.x` | When assigned a value, both the default and api lambdas will be assigned the runtime defined in the value. When assigned to an object, values for the default and api lambdas can be separately defined |
509+
| runtime | `string\|object` | `nodejs14.x` | When assigned a value, both the default and api lambdas will be assigned the runtime defined in the value. When assigned to an object, values for the default and api lambdas can be separately defined |
505510
| memory | `number\|object` | `512` | When assigned a number, both the default and api lambdas will be assigned memory of that value. When assigned to an object, values for the default and api lambdas can be separately defined |
511+
| tags | `object` | `undefined` | Tags to assign to a Lambda. If undefined, the component will not update any tags. If set to an empty object, it will remove all tags. |
506512
| timeout | `number\|object` | `10` | Same as above |
507513
| handler | `string` | `index.handler` | When assigned a value, overrides the default function handler to allow for configuration. Copies `handler.js` in route into the Lambda folders. Your handler MUST still call the `default-handler` afterwards or your function won't work with Next.JS |
508514
| name | `string\|object` | / | When assigned a string, both the default and api lambdas will assigned name of that value. When assigned to an object, values for the default and api lambdas can be separately defined |

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.1.1-alpha.0",
2+
"version": "3.2.0-alpha.6",
33
"npmClient": "yarn",
44
"command": {
55
"publish": {

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"packages-build": "lerna run build",
2121
"test:watch": "yarn test --watch --collect-coverage=false",
2222
"check-gh-token": ": \"${GH_TOKEN:?Please set GH_TOKEN to a GitHub personal token that can create releases.}\"",
23-
"prerelease": "yarn check-gh-token && yarn install && lerna publish --conventional-commits --conventional-prerelease --exact --create-release github --dist-tag alpha",
24-
"graduate": "yarn check-gh-token && yarn install && lerna version --conventional-commits --conventional-graduate --exact --create-release github && lerna publish from-git",
23+
"prerelease": "yarn check-gh-token && lerna publish --conventional-commits --conventional-prerelease --exact --create-release github --dist-tag alpha",
24+
"graduate": "yarn check-gh-token && lerna version --conventional-commits --conventional-graduate --exact --create-release github && lerna publish from-git",
2525
"lint": "eslint .",
2626
"integration": "jest --runInBand --config jest.integration.config.json --setupTestFrameworkScriptFile=./jest.integration.setup.js",
2727
"postinstall": "yarn packages-install && opencollective-postinstall",
@@ -86,7 +86,9 @@
8686
"/examples/",
8787
"/dist/",
8888
"/e2e-tests/",
89-
"/tests/"
89+
"/tests/",
90+
"babel.config.js",
91+
"jest.config.js"
9092
],
9193
"watchPathIgnorePatterns": [
9294
"/fixture/",

packages/e2e-tests/next-app/serverless.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ next-app:
1010
api/*:
1111
forward:
1212
headers: [Authorization]
13+
tags:
14+
defaultLambda:
15+
tag1: val1
16+
apiLambda:
17+
tag2: val2
18+
imageLambda:
19+
tag3: val3
20+
regenerationLambda:
21+
tag4: val4

packages/libs/cloudfront/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [3.2.0-alpha.5](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.4...v3.2.0-alpha.5) (2021-06-27)
7+
8+
**Note:** Version bump only for package @sls-next/cloudfront
9+
10+
# [3.2.0-alpha.4](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.3...v3.2.0-alpha.4) (2021-06-27)
11+
12+
### Bug Fixes
13+
14+
- update aws retry logic and fix dependencies ([#1306](https://github.com/serverless-nextjs/serverless-next.js/issues/1306)) ([e0cee9c](https://github.com/serverless-nextjs/serverless-next.js/commit/e0cee9c0d5d79314a7239c37e55438b5200d8bb2))
15+
16+
# [3.2.0-alpha.2](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.2.0-alpha.1...v3.2.0-alpha.2) (2021-06-26)
17+
18+
**Note:** Version bump only for package @sls-next/cloudfront
19+
620
# [3.1.0](https://github.com/serverless-nextjs/serverless-next.js/compare/v3.1.0-alpha.16...v3.1.0) (2021-06-25)
721

822
**Note:** Version bump only for package @sls-next/cloudfront

packages/libs/cloudfront/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sls-next/cloudfront",
3-
"version": "3.1.0",
3+
"version": "3.2.0-alpha.5",
44
"description": "Handles CloudFront invalidation",
55
"publishConfig": {
66
"access": "public"
@@ -16,8 +16,9 @@
1616
"directory": "packages/libs/cloudfront"
1717
},
1818
"scripts": {
19-
"prepare": "yarn build",
20-
"build": "tsc -p tsconfig.build.json"
19+
"prepare": "yarn clean && yarn build",
20+
"build": "tsc -p tsconfig.build.json",
21+
"clean": "yarn rimraf dist"
2122
},
2223
"keywords": [
2324
"AWS",
@@ -36,6 +37,7 @@
3637
},
3738
"devDependencies": {
3839
"@types/node": "^15.12.2",
40+
"rimraf": "^3.0.2",
3941
"typescript": "^4.3.4"
4042
}
4143
}

packages/libs/cloudfront/src/lib/cloudfront.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ export type Credentials = {
2929
export default ({
3030
credentials
3131
}: CloudFrontClientFactoryOptions): CloudFrontClient => {
32+
if (AWS?.config) {
33+
AWS.config.update({
34+
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES ?? "10"),
35+
retryDelayOptions: { base: 200 }
36+
});
37+
}
38+
3239
const cloudFront = new AWS.CloudFront({ credentials });
3340

3441
return {

0 commit comments

Comments
 (0)