I am trying to deploy Lambda@Edge using following yaml
serverless.yml
> service: viewer-request
> provider:
> name: aws
> runtime: nodejs12.x
> region: ${opt:region, 'us-east-1'}
> stage: ${opt:stage, 'staging'}
> memorySize: 128
> timeout: 10
>
> functions:
> viewerRequest:
> handler: handler.viewerRequest
>
> resources:
> Resources:
> IamRoleLambdaExecution:
> Type: "AWS::IAM::Role"
> Properties:
> AssumeRolePolicyDocument:
> Statement:
> - Effect: Allow
> Principal:
> Service:
> - lambda.amazonaws.com
> - edgelambda.amazonaws.com
> plugins:
> - serverless-offline
Then set trigger
Event type: viewer-request
Include body: No
Path pattern: /images/*
But when I try to access web contents I get following error
2020-08-17 20:47:53 EWR52-C4 1274 72.79.124.96 GET r1gcva4mhojctg.cloudfront.net /images/email_icon.svg 503 https://stage.domain.com/ Mozilla/5.0%20(Macintosh;%20Intel%20Mac%20OS%20X%2010_15_5)%20AppleWebKit/537.36%20(KHTML,%20like%20Gecko)%20Chrome/84.0.4147.125%20Safari/537.36 - - LambdaExecutionError nkMyhXkEzWo6CMsOdS7qNS-fszUuQJ-FW6UDxYdKqxOuSoQmffKVwA== stage.domain.com https 48 1.472 - TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 LambdaExecutionError HTTP/2.0 - - 52571 1.472 LambdaExecutionError text/html 1019 - -
Anyone know what I am missing here ?