aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.47k stars 1.16k forks source link

Bug: sam validate does not support language extension #4835

Open napso opened 1 year ago

napso commented 1 year ago

Description:

sam validate command does not support AWS Language Extensions although it was mentioned to be patched in version 1.56.1.

Also mentioned here

Steps to reproduce:

  1. Create a new project with Poetry: poetry new sam-validate-test
  2. Install aws-sam-cli: poetry add aws-sam-cli
  3. Create a new SAM template with AWS Language Extensions support:

such as:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::LanguageExtensions'

Parameters:
...

Resources:
  TestBucket:
  Type: AWS::S3::Bucket
  Properties:
  ... 
    UpdateReplacePolicy: !If [IsDevDeployment, "Delete", "Retain"]
    DeletionPolicy: !If [IsDevDeployment, "Delete", "Retain"]
  1. Validate the SAM template with SAM CLI: sam validate -t template.yaml

Observed result:

The command fails with the following error message:

Error: [InvalidTemplateException('Every DeletionPolicy member must be a string.')] Every DeletionPolicy member must be a string.

Expected result:

There should be no error message

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

SAM CLI, version 1.76.0

❯ sam --info
{
  "version": "1.76.0",
  "system": {
    "python": "3.9.5",
    "os": "Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.31"
  },
  "additional_dependencies": {
    "docker_engine": "Not available",
    "aws_cdk": "2.53.0 (build 7690f43)",
    "terraform": "Not available"
  }
}
mndeveci commented 1 year ago

Hi @napso, thanks for raising this issue!

SAM CLI doesn't support language extensions with sam validate command as of now, other commands should be working as expected. I will flag this feature request and take it to our PMs.

napso commented 1 year ago

Hi @napso, thanks for raising this issue!

SAM CLI doesn't support language extensions with sam validate command as of now, other commands should be working as expected. I will flag this feature request and take it to our PMs.

I see, thank you.

francisreyes-tfs commented 11 months ago

other commands should be working as expected.

Unfortunately, sam deploy won't work with language extensions so its not just not limited to sam validate.

shashanklmurthy commented 10 months ago

+1 for this feature

haenggi001 commented 6 months ago

+1 for this, would be nice to get that fixed soon.

redaLaanait commented 5 months ago

+1 for this, sam publish does not support language extension too.

randradas commented 3 months ago

+1 for this