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

Some server-side website construct are sometimes forwarded to AWS Lambda #390

Open
johnrobertcobbold opened this issue May 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@johnrobertcobbold
Copy link

johnrobertcobbold commented May 2, 2024

Description

While reviewing the Lambda logs of a server-side website construct, I see that certain requests which are usually correctly forwarded to static assets S3 bucket are sometimes forwarded to AWS Lambda. This obviously results in 404 errors.

For example:

  • /pwa/favicon-196.png
 [2024-05-02T04:42:53.958839+00:00] logger.ERROR: Not found. {"exception":"[object] (Slim\\Exception\\HttpNotFoundException(code: 404): Not found. at /var/task/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php:76)","method":"GET","url":"http://xxx.execute-api.ap-southeast-1.amazonaws.com:443/pwa/favicon-196.png","referrer":"https://xxx.execute-api.ap-southeast-1.amazonaws.com/en/?fbclid=IwZXh0bgNhZW0CMTEAAR0PtKUWFWvg9PHimsA-6y84pOkK1FCcxbf8O8rlYmLo-u4xO0FrUOPvUAI_aem_AUtxay_7VRn54mDn_VJ2ugNPswgywsH06JRX-4GNQtqEbT1X5nKuV2dxh6dy4ONv4ruNRgfEB-i2ikvz9ur6sUOa"} []
  • /img/logos/logo.jpg
[2024-05-02T04:43:24.136274+00:00] logger.ERROR: Not found. {"exception":"[object] (Slim\\Exception\\HttpNotFoundException(code: 404): Not found. at /var/task/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php:76)","method":"GET","url":"http://xxx.execute-api.ap-southeast-1.amazonaws.com:443/img/logos/logo.jpg","referrer":""} []

I have enabled Standard logging on the S3 bucket (see serverless.yml configuration) but do not see anything relevant.

How to Reproduce

constructs:
website:
type: server-side-website
certificate: ${self:custom.certificate.${self:provider.environment.ENV}}
domain: ${self:custom.websiteDomain.${self:provider.environment.ENV}}
redirectToMainDomain: ${self:custom.websiteRedirectToMainDomain.${self:provider.environment.ENV}}
assets:
'/js/': public/js
'/css/
': public/css
'/fonts/': public/fonts/
'/pwa/
': public/pwa/
'/img/*': public/img/
extensions:
distribution:
Properties:
DistributionConfig:
Logging:
Bucket: XXX-cloudfront-logs-bucket-${self:provider.environment.ENV}.s3.amazonaws.com
IncludeCookies: false

resources:
Resources:
Route53Records:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneId: ${self:custom.hostedZoneId.${self:provider.environment.ENV}}
RecordSets: ${self:custom.route53RecordSets.${self:provider.environment.ENV}}
CloudFrontLogsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: XXX-cloudfront-logs-bucket-${self:provider.environment.ENV}
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerPreferred

Additional Information

"serverless-lift": "^1.25"

@johnrobertcobbold johnrobertcobbold added the bug Something isn't working label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant