Hi,
After we upgraded to serverless 2.43.1 we got some errors running sls deploy
-------------S3 Policy error-----------------------
Policy has invalid resource (Service: Amazon S3; Status Code: 400; Error Code: MalformedPolicy; Request ID: 198Q65NJ254F3Y8A; S3 Extended Request ID: lGQsV5cjUrjxeDThZQjR3EtgHzXrThbS8mLnHlXEHH6TNqNBIJP9ehrxQxTT36FmxJFWV2AFAw4=; Proxy: null)
-------------YAML file-----------------
Resources:
ReactAppBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${file(./serverless.yaml):custom.bucketName}
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: index.html
VersioningConfiguration:
Status: Enabled
S3AccessPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: ReactAppBucket
PolicyDocument:
Statement:
- Sid: PublicReadGetObject
Effect: Allow
Principal: ""
Action:
- s3:GetObject
Resource: arn:aws:s3:::${file(./serverless.yaml):custom.bucketName}/
second error is clouffront
---------------CloudFront error ---------------------
Resource handler returned message: “Invalid request provided: The parameter origin name cannot contain a colon. (Service: CloudFront, Status Code: 400, Request ID: c24d4fa6-c7c2-4b4b-905a-99e0b2d6ad75, Extended Request ID: null)” (RequestToken: 98cc72e6-7771-747f-e833-0bbf76f87c45, HandlerErrorCode: InvalidRequest)
I have checked but there is no colon when doing sls print
Resources:
CloudFrontDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Origins:
- DomainName: ${file(./serverless.yaml):custom.bucketName}.s3.amazonaws.com
Id: ReactApp
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: https-only
- DomainName: ${file(./serverless.yaml):custom.API_URL_${opt:stage, self:provider.stage}}
Id: iHubAPI
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: https-only
Enabled: “true”
DefaultRootObject: index.html
CustomErrorResponses:
- ErrorCode: 404
ResponseCode: 200
ResponsePagePath: /index.html
DefaultCacheBehavior:
AllowedMethods:
- DELETE
- GET
- HEAD
- OPTIONS
- PATCH
- POST
- PUT
TargetOriginId: ReactApp
ForwardedValues:
QueryString: “false”
Cookies:
Forward: none
ViewerProtocolPolicy: redirect-to-https
DefaultTTL: 1800 #${file(./serverless.yaml):custom.cacheTTL}
MaxTTL: 1800 #${file(./serverless.yaml):custom.cacheTTL}
CacheBehaviors:
- AllowedMethods:
- DELETE
- GET
- HEAD
- OPTIONS
- PATCH
- POST
- PUT
TargetOriginId: iHubAPI
ForwardedValues:
QueryString: “true”
Cookies:
Forward: all
Headers:
- Authorization
ViewerProtocolPolicy: allow-all
PathPattern: /${opt:stage, self:provider.stage}/*
ViewerCertificate:
AcmCertificateArn: arn:aws:acm:us-east-1:23569041497:certificate/356767-65a6-8865g-928b-86ecac553978
SslSupportMethod: sni-only
MinimumProtocolVersion: TLSv1.2_2019
Aliases:
- “myalias${opt:stage, self:provider.stage}.mydomain.net”
Any suggestion on how to solve this?