ServerlessLife / lambda-live-debugger

Remote debugging AWS Lambda functions
https://www.lldebugger.com/
Mozilla Public License 2.0
35 stars 3 forks source link

YAMLWarnings in output with SAM #49

Closed eliasbrange closed 2 months ago

eliasbrange commented 2 months ago

Running LLD outputs a bunch of YAMLWarning messages, even if everything is OK. While not a showstopper, they are a tad bit annoying.

Example output:

Welcome to Lambda Live Debugger 🐞 version 1.0.0.
To keep the project moving forward, please fill out the feedback form at https://forms.gle/v6ekZtuB45Rv3EyW9. Your input is greatly appreciated!
Starting the debugger (ID 7088db535be79152e77f973d1f652297)...
(node:15270) [TAG_RESOLVE_FAILED] YAMLWarning: Unresolved tag: !Ref at line 27, column 17:

      LogGroup: !Ref StackLogGroup
                ^^^^

(Use `node --trace-warnings ...` to show where the warning was created)
(node:15270) [TAG_RESOLVE_FAILED] YAMLWarning: Unresolved tag: !Ref at line 33, column 21:

      LogGroupName: !Ref "AWS::StackName"
                    ^^^^

(node:15270) [TAG_RESOLVE_FAILED] YAMLWarning: Unresolved tag: !Sub at line 51, column 12:

    Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazon…
           ^^^^

Found the following Lambdas to debug:

Example SAM template:

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
  sam-nodejs-tmp

Metadata: &esbuild
  BuildMethod: esbuild
  BuildProperties:
    Minify: true
    Target: "es2020"
    Sourcemap: true

Globals:
  Function:
    Runtime: nodejs20.x
    MemorySize: 1769
    Architectures:
      - arm64
    Environment:
      Variables:
        POWERTOOLS_SERVICE_NAME: sam-nodejs-tmp
        POWERTOOLS_METRICS_NAMESPACE: sam-nodejs-tmp
    Timeout: 30
    Tracing: Active
    LoggingConfig:
      LogFormat: JSON
      LogGroup: !Ref StackLogGroup

Resources:
  StackLogGroup:
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupName: !Ref "AWS::StackName"
      RetentionInDays: 30

  ApiFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: src/functions/api.handler
      Events:
        TodoApi:
          Type: HttpApi
          Properties:
            Path: /hello
            Method: get
    Metadata: *esbuild

Outputs:
  ApiURL:
    Description: "API Gateway endpoint URL"
    Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com"
ServerlessLife commented 2 months ago

Thank you.

I will look into that.

ServerlessLife commented 2 months ago

The issue is fixed. Can you verify?

eliasbrange commented 2 months ago

The issue is fixed. Can you verify?

Works great!