Skip to content

'AutoPublishAlias' must be a string or a Ref to a template parameter #3717

Open
@joaowingmaite

Description

@joaowingmaite

Description

When using sam deploy with the AutoPublishAlias property in the template it always returns the error:

Error: Failed to create changeset for the stack: stack-name, ex: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [DocumentLoaderFunction] is invalid. 'AutoPublishAlias' must be a string or a Ref to a template parameter

Note 1: This happens wether I use a string directly or a !Ref to a Template Parameter
Note 2: This fails in macOS, but for example when running in a Github Action it works correctly.

Steps to reproduce

Use the following template:

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
  Sample

Globals:
  Function:
    Timeout: 30

Resources:
  SomeFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: function/
      Handler: app.lambdaHandler
      Runtime: nodejs20.x
      MemorySize: 512
      Timeout: 60
      FunctionName: SomeFunction
      AutoPublishAlias: DEV
      Architectures:
        - x86_64
      Role: arn:aws:iam::XXXXXX:role/SomeRole
    Metadata: # Manage esbuild properties
      BuildMethod: esbuild
      BuildProperties:
        Minify: true
        Target: "es2020"
        Sourcemap: true
        EntryPoints:
          - app.ts

Run

sam deploy

Observed result

Error: Failed to create changeset for the stack: stack-name, ex: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [DocumentLoaderFunction] is invalid. 'AutoPublishAlias' must be a string or a Ref to a template parameter

Expected result

A success full deploy

Additional environment details

  1. OS: macOS 15.3 (Sequoia)
  2. If using the SAM CLI, sam --version: 1.133.0
  3. AWS region: eu-central-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    stage/needs-investigationRequires a deeper investigationstage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions