Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

domainName should be checked before replacing #1382

Merged
merged 3 commits into from
Jul 9, 2021

Conversation

peniakoff
Copy link
Contributor

Issue has been described here: #1381

@@ -2,5 +2,5 @@ export const s3BucketNameFromEventRequest = (
request: AWSLambda.CloudFrontRequest
): string | undefined => {
const { region, domainName } = request.origin?.s3 || {};
return domainName?.replace(`.s3.${region}.amazonaws.com`, "");
return domainName?.includes(region) ? domainName.replace(`.s3.${region}.amazonaws.com`, "") : domainName.replace(`.s3.amazonaws.com`, "");
Copy link
Collaborator

@dphang dphang Jul 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is the automated Codacy suggestion (though it doesn't seem correct?), though the code build itself was also failing due to type errors, so that might be why it made that suggestion.

@dphang
Copy link
Collaborator

dphang commented Jul 8, 2021

Looks like some unit tests have failed. E.g previously was expecting:

"Bucket": "my-bucket.s3.amazonaws.com"

but now bucket is my-bucket (so technically it is correct now). Please fix and then I will approve it.

Now 'Bucket: "my-bucket"' is expected.
@slsnextbot
Copy link
Collaborator

Handler Size Report

There are changes to handler sizes. Please review.

Base Handler Sizes (kB) (commit 28c8bd6)

{
    "Lambda@Edge": {
        "Default Lambda": {
            "Standard": 1231,
            "Minified": 435
        },
        "API Lambda": {
            "Standard": 85,
            "Minified": 34
        },
        "Image Lambda": {
            "Standard": 903,
            "Minified": 357
        },
        "Regeneration Lambda": {
            "Standard": 629,
            "Minified": 223
        }
    }
}

New Handler Sizes (kB) (commit 3be15e4)

{
    "Lambda@Edge": {
        "Default Lambda": {
            "Standard": 1226,
            "Minified": 432
        },
        "API Lambda": {
            "Standard": 86,
            "Minified": 34
        },
        "Image Lambda": {
            "Standard": 894,
            "Minified": 354
        },
        "Regeneration Lambda": {
            "Standard": 620,
            "Minified": 220
        }
    }
}

@codecov
Copy link

codecov bot commented Jul 8, 2021

Codecov Report

Merging #1382 (8794c73) into master (28c8bd6) will increase coverage by 0.27%.
The diff coverage is 87.17%.

❗ Current head 8794c73 differs from pull request most recent head 3be15e4. Consider uploading reports for the commit 3be15e4 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1382      +/-   ##
==========================================
+ Coverage   83.86%   84.14%   +0.27%     
==========================================
  Files          97       96       -1     
  Lines        3371     3367       -4     
  Branches     1001      995       -6     
==========================================
+ Hits         2827     2833       +6     
+ Misses        482      474       -8     
+ Partials       62       60       -2     
Impacted Files Coverage Δ
...s/libs/lambda-at-edge/src/images/imageOptimizer.ts 81.27% <ø> (ø)
...ambda-at-edge/src/lib/triggerStaticRegeneration.ts 100.00% <ø> (ø)
packages/libs/lambda-at-edge/src/s3/s3StorePage.ts 90.47% <ø> (ø)
...ackages/libs/lambda-at-edge/src/default-handler.ts 89.09% <63.63%> (+1.09%) ⬆️
packages/libs/core/src/handle/fallback.ts 97.22% <92.85%> (+0.92%) ⬆️
...ayers/lambda-at-edge-compat/next-aws-cloudfront.js 100.00% <100.00%> (ø)
packages/libs/core/src/build/index.ts 95.18% <100.00%> (+0.24%) ⬆️
packages/libs/core/src/route/data.ts 100.00% <100.00%> (ø)
packages/libs/core/src/route/page.ts 100.00% <100.00%> (ø)
...bda-at-edge/src/s3/s3BucketNameFromEventRequest.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28c8bd6...3be15e4. Read the comment docs.

@dphang
Copy link
Collaborator

dphang commented Jul 9, 2021

Manually ran e2e tests here: https://github.com/serverless-nextjs/serverless-next.js/actions/runs/1013949580. Will merge after it passes.

@dphang dphang merged commit 72df9ad into serverless-nextjs:master Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants