Skip to content

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

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

Open
joaowingmaite opened this issue Feb 12, 2025 · 1 comment
Open
Labels
stage/needs-investigation Requires a deeper investigation stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Comments

@joaowingmaite
Copy link

joaowingmaite commented Feb 12, 2025

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
@joaowingmaite joaowingmaite added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Feb 12, 2025
@vicheey
Copy link
Contributor

vicheey commented Feb 17, 2025

Thank you. Will try to reproduce the bug.

@vicheey vicheey added the stage/needs-investigation Requires a deeper investigation label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/needs-investigation Requires a deeper investigation stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.
Projects
None yet
Development

No branches or pull requests

2 participants