Skip to content

Docs: Event Handler - Broken AWS Serverless Application Model (SAM) example #1069

Closed
@michaelbrewer

Description

@michaelbrewer

What were you trying to accomplish?

Use the provided sam example

Expected Behavior

Provided example should pass cfn-lint and sam validate

Current Behavior

Copied example produces the following error:

Screen Shot 2022-05-20 at 1 06 44 PM

Possible Solution

Fixes by PR #1117 deployed example at https://gyft.github.io/aws-lambda-powertools-python/latest/core/event_handler/appsync/#required-resources

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Hello world event handler API Gateway

Globals:
  Api:
    TracingEnabled: true
    Cors:                           # see CORS section
      AllowOrigin: "'https://example.com'"
      AllowHeaders: "'Content-Type,Authorization,X-Amz-Date'"
      MaxAge: "'300'"
    BinaryMediaTypes:               # see Binary responses section
      - '*~1*'  # converts to */* for any binary type
  Function:
    Timeout: 5
    Runtime: python3.9
    Tracing: Active
    Environment:
      Variables:
        LOG_LEVEL: INFO
        POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
        POWERTOOLS_LOGGER_LOG_EVENT: true
        POWERTOOLS_METRICS_NAMESPACE: MyServerlessApplication
        POWERTOOLS_SERVICE_NAME: my_api-service

Resources:
  ApiFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: app.lambda_handler
      CodeUri: api_handler/
      Description: API handler function
      Events:
        ApiEvent:
          Type: Api
          Properties:
            Path: /{proxy+}  # Send requests on any path to the lambda function
            Method: ANY  # Send requests using any http method to the lambda function

Steps to Reproduce (for bugs)

  1. Copy yaml from REST API : Required resources
  2. Run cfn-lint

Environment

  • Powertools version used: N/A
  • Packaging format (Layers, PyPi): N/A
  • AWS Lambda function runtime: N/A
  • Debugging logs
E0000 Null value at line 6 column 9
template.yaml:6:9

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions