Skip to content

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

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

Closed
michaelbrewer opened this issue Mar 8, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@michaelbrewer
Copy link
Contributor

michaelbrewer commented Mar 8, 2022

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
@michaelbrewer michaelbrewer added bug Something isn't working triage Pending triage from maintainers labels Mar 8, 2022
@michaelbrewer
Copy link
Contributor Author

This was fixed as part of pulling out the code examples into separate files.

@heitorlessa heitorlessa added documentation Improvements or additions to documentation triage Pending triage from maintainers and removed bug Something isn't working triage Pending triage from maintainers labels Apr 12, 2022
@heitorlessa
Copy link
Contributor

Fixing the labels (documentation, over bug).

michaelbrewer added a commit to gyft/aws-lambda-powertools-python that referenced this issue Apr 12, 2022
Changes:
- Extract all code examples
- Fix yaml, terraform and python
- Add make file to format, lint and validate examples

Related to
- aws-powertools#1064

Fixed
- aws-powertools#1067
- aws-powertools#1069
michaelbrewer added a commit to gyft/aws-lambda-powertools-python that referenced this issue Apr 13, 2022
Changes:
- Extract code examples
- Fix python and yaml files
- Run isort and black
- Add make task

Closes:
- aws-powertools#1069

Related:
- aws-powertools#1064
@michaelbrewer michaelbrewer changed the title fix(rest-api): broken AWS Serverless Application Model (SAM) example Bug: broken AWS Serverless Application Model (SAM) example May 17, 2022
@michaelbrewer michaelbrewer changed the title Bug: broken AWS Serverless Application Model (SAM) example Bug: HomePage, broken AWS Serverless Application Model (SAM) example May 18, 2022
@michaelbrewer michaelbrewer changed the title Bug: HomePage, broken AWS Serverless Application Model (SAM) example Bug: HomePage - broken AWS Serverless Application Model (SAM) example May 18, 2022
@sthulb sthulb changed the title Bug: HomePage - broken AWS Serverless Application Model (SAM) example Docs: HomePage - broken AWS Serverless Application Model (SAM) example May 18, 2022
@michaelbrewer michaelbrewer changed the title Docs: HomePage - broken AWS Serverless Application Model (SAM) example Docs: Event Handler - broken AWS Serverless Application Model (SAM) example May 20, 2022
@michaelbrewer michaelbrewer changed the title Docs: Event Handler - broken AWS Serverless Application Model (SAM) example Docs: Event Handler - Broken AWS Serverless Application Model (SAM) example May 20, 2022
@sthulb sthulb closed this as completed Jun 14, 2022
@github-actions
Copy link
Contributor

Comments on closed issues are hard for our team to see.

@heitorlessa heitorlessa removed the triage Pending triage from maintainers label Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
3 participants