Skip to content

amplify push function also pushes GraphQL API, fails if GraphQL has IAM #12348

Open
@josefaidt

Description

@josefaidt

How did you install the Amplify CLI?

pnpm

If applicable, what version of Node.js are you using?

18

Amplify CLI Version

11.0.3

What operating system are you using?

mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

n/a

Describe the bug

amplify push function should fail fast if no functions are available in the project

➜  amplify push function
⠴ Building resource api/a12289✅ GraphQL schema compiled successfully.

Edit your schema at /Users/josef/Documents/projects/aws-amplify/reproductions/a12289two/amplify/backend/api/a12289/schema.graphql or place .graphql files in a directory at /Users/josef/Documents/projects/aws-amplify/reproductions/a12289two/amplify/backend/api/a12289/schema

    Current Environment: dev
    
┌──────────┬───────────────┬───────────┬─────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
└──────────┴───────────────┴───────────┴─────────────────┘
✔ Are you sure you want to continue? (Y/n) · yes
✅ GraphQL schema compiled successfully.

Edit your schema at /Users/josef/Documents/projects/aws-amplify/reproductions/a12289two/amplify/backend/api/a12289/schema.graphql or place .graphql files in a directory at /Users/josef/Documents/projects/aws-amplify/reproductions/a12289two/amplify/backend/api/a12289/schema
⠦ Building resource api/a12289✅ GraphQL schema compiled successfully.

Edit your schema at /Users/josef/Documents/projects/aws-amplify/reproductions/a12289two/amplify/backend/api/a12289/schema.graphql or place .graphql files in a directory at /Users/josef/Documents/projects/aws-amplify/reproductions/a12289two/amplify/backend/api/a12289/schema

Deployment failed.
Deploying root stack a12289 [ ========-------------------------------- ] 1/5
        amplify-a12289-dev-155308      AWS::CloudFormation::Stack     UPDATE_ROLLBA
        autha12289c4c09eca             AWS::CloudFormation::Stack     UPDATE_COMPLE
        apia12289                      AWS::CloudFormation::Stack     UPDATE_FAILED

🛑 The following resources failed to deploy:
Resource Name: apia12289 (AWS::CloudFormation::Stack)
Event Type: update
Reason: Parameters: [unauthRoleName, authRoleName] must have values
URL: https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/arn%3Aaws%3Acloudformation%3Aus-east-1%3A814763596509%3Astack%2Famplify-a12289-dev-155308%2F51d30730-c904-11ed-9dd2-12f540fc6bd9/events


PushResourcesFault: Resource is not in the state stackUpdateComplete
    at AmplifyToolkit.pushResources (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:143:23)
    at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-function/lib/index.js:277:5)
    at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:135:5)
    at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:33:9)
    at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:117:5)
An error occurred when pushing the function resource

Expected behavior

➜  amplify push function
No functions are available in this Amplify project

Reproduction steps

  1. amplify init -y
  2. amplify add api > GraphQL
  3. amplify push function
  4. observe CLI does not fail, prints an empty status page, then proceeds with pushing the API

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-graphqlIssues related to GraphQL resources in the API categorybugSomething isn't workingduplicateIf marked with duplicate, issue will be closed & original will be added for traceabilityfunctionsIssues tied to the functions categoryp2regressionFlair label to track regressions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions