aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
459 stars 116 forks source link

Unable to deploy new builds, error in both hosting environment and backend environment #2513

Closed SaileshKumar closed 2 years ago

SaileshKumar commented 2 years ago

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Categories

auth, function, api

Environment information

``` # Put output below this line saileshkumar@Saileshs-MacBook-Pro ruso % npx envinfo --system --binaries --browsers --npmPackages --duplicates --npmGlobalPackages System: OS: macOS 11.3.1 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 10.95 GB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.18.1 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 6.14.15 - /usr/local/bin/npm Browsers: Chrome: 97.0.4692.71 Firefox: 95.0.2 Safari: 14.1 npmPackages: @aws-amplify/auth: ^4.3.20 => 4.3.20 @aws-amplify/cli: ^7.6.9 => 7.6.9 @aws-amplify/core: ^4.3.12 => 4.3.12 @daily-co/daily-js: ^0.21.0 => 0.21.0 @date-io/date-fns: ^1.3.13 => 1.3.13 @material-ui/core: ^4.11.4 => 4.12.3 @material-ui/icons: ^4.11.2 => 4.11.2 @material-ui/pickers: ^3.3.10 => 3.3.10 @material-ui/styles: ^4.11.4 => 4.11.4 @reduxjs/toolkit: ^1.5.1 => 1.7.0 @reduxjs/toolkit-query: 1.0.0 @reduxjs/toolkit-query-react: 1.0.0 @testing-library/jest-dom: ^5.11.4 => 5.16.1 @testing-library/react: ^11.1.0 => 11.2.7 @testing-library/user-event: ^12.1.10 => 12.8.3 HelloWorld: 0.0.1 antd: ^4.16.13 => 4.17.3 aws-amplify: ^4.3.12 => 4.3.12 aws-appsync: ^4.1.2 => 4.1.4 cypress: ^8.3.1 => 8.7.0 date-fns: ^2.23.0 => 2.27.0 es6-promise: ^4.2.8 => 4.2.8 flow-bin: ^0.148.0 => 0.148.0 graphql-tag: ^2.12.5 => 2.12.6 (2.10.1) hermes-inspector-msggen: 1.0.0 hls.js: ^1.1.2 => 1.1.2 mixpanel-browser: ^2.41.0 => 2.42.0 moment: ^2.29.1 => 2.29.1 moment-timezone: ^0.5.33 => 0.5.34 (0.5.27) new-plugin-package: 1.0.0 react: ^17.0.2 => 17.0.2 react-datetime: ^3.1.1 => 3.1.1 react-device-detect: ^2.1.2 => 2.1.2 react-dom: ^17.0.2 => 17.0.2 react-easy-crop: ^3.5.2 => 3.5.3 react-error-overlay: 6.0.9 => 6.0.9 (6.0.10) react-google-button: ^0.7.2 => 0.7.2 react-google-calendar-api: ^1.4.0 => 1.4.0 react-native: ^0.64.0 => 0.64.3 react-player: ^2.9.0 => 2.9.0 react-redux: ^7.2.4 => 7.2.6 react-router-dom: ^5.2.0 => 5.3.0 react-scripts: ^4.0.3 => 4.0.3 react-select: ^5.2.1 => 5.2.1 react-social-icons: ^5.5.0 => 5.6.1 request: ^2.88.2 => 2.88.2 stream-chat: ^4.2.0 => 4.4.3 stream-chat-react: ^6.12.0 => 6.12.2 styled-components: ^5.3.1 => 5.3.3 styled-components/macro: undefined () styled-components/native: undefined () styled-components/primitives: undefined () url-loader: ^4.1.1 => 4.1.1 web-vitals: ^1.0.1 => 1.1.2 npmGlobalPackages: @aws-amplify/cli: 7.4.5 n: 8.0.0 npm: 6.14.15 ```

Describe the bug

App ID - d2043y24tqcg54 Region - us-east-2

WHenever I push a change to github, the deployment fails on Amplify. Interestingly enough I can push with amplify push, but just not the auto deployments.

I get one error on the "hosted environment" tab, and one error on the "backend environment" tab.

Hosted:

Following resources failed
                                 Resource Name: us-east-2_A4TtUyyWy (AWS::Cognito::UserPool)
                                 Event Type: update
                                 Reason: Invalid AttributeDataType input, consider using the provided AttributeDataType enum. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: c3849e94-7b7a-466c-ac95-7bb3888f9851; Proxy: null)
                                 URL: https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/arn%3Aaws%3Acloudformation%3Aus-east-2%3A380051505579%3Astack%2Famplify-lighthall-dev-123155-authlighthall-1G771JFMS7CVE%2F30877860-3826-11ec-a61f-02201aaf7cd2/events

Backend:

auth headless is missing the following inputParams facebookAppIdUserPool, facebookAppSecretUserPool, googleAppIdUserPool, googleAppSecretUserPool.

I haven't added any new attributes, nor does cloudformation url seem to resolve anywhere. It's currently blocking my deployments, any ideas how to fix?

Separately, I previously configured these as environment variables:

AMPLIFY_FACEBOOK_CLIENT_ID AMPLIFY_FACEBOOK_CLIENT_SECRET AMPLIFY_GOOGLE_CLIENT_ID AMPLIFY_GOOGLE_CLIENT_SECRET

Expected behavior

Any new commit to the branch hooked up to Amplify should successfully redeploy.

Reproduction steps

Reproduced with pushing to my branch that deploys Amplify: git push origin master

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line ```

aws-exports.js

/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
    "aws_project_region": "us-east-2",
    "aws_cognito_identity_pool_id": "us-east-2:182e12cc-153f-47a2-b727-06157343fce0",
    "aws_cognito_region": "us-east-2",
    "aws_user_pools_id": "us-east-2_A4TtUyyWy",
    "aws_user_pools_web_client_id": "45ni1kh51m1i94bt9ri9g5kpht",
    "oauth": {
        "domain": "lighthall4fdd6b2e-4fdd6b2e-dev.auth.us-east-2.amazoncognito.com",
        "scope": [
            "phone",
            "email",
            "openid",
            "profile",
            "aws.cognito.signin.user.admin"
        ],
        "redirectSignIn": "http://localhost:3000/,https://www.lighthall.co/",
        "redirectSignOut": "http://localhost:3000/,https://www.lighthall.co/",
        "responseType": "code"
    },
    "federationTarget": "COGNITO_USER_AND_IDENTITY_POOLS",
    "aws_cognito_username_attributes": [
        "EMAIL"
    ],
    "aws_cognito_social_providers": [
        "FACEBOOK",
        "GOOGLE"
    ],
    "aws_cognito_signup_attributes": [
        "EMAIL",
        "FAMILY_NAME",
        "GIVEN_NAME",
        "PICTURE"
    ],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [
        "SMS"
    ],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": []
    },
    "aws_cognito_verification_mechanisms": [
        "EMAIL"
    ],
    "aws_appsync_graphqlEndpoint": "https://65utmuikuzc2nlia7xvgeph4zy.appsync-api.us-east-2.amazonaws.com/graphql",
    "aws_appsync_region": "us-east-2",
    "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS",
    "aws_appsync_apiKey": "da2-uqeawvsvxjfqzhrehsnnmbvfou",
    "aws_user_files_s3_bucket": "lighthall2c611176821246569e6c532fb58505a3123155-dev",
    "aws_user_files_s3_bucket_region": "us-east-2",
    "aws_cognito_login_mechanisms": [
        "EMAIL"
    ]
};

export default awsmobile;

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

auth/cli-inputs.json:

{
  "version": "1",
  "cognitoConfig": {
    "identityPoolName": "lighthallbfd910c3_identitypool_bfd910c3",
    "allowUnauthenticatedIdentities": false,
    "resourceNameTruncated": "lighthbfd910c3",
    "userPoolName": "lighthallbfd910c3_userpool_bfd910c3",
    "autoVerifiedAttributes": [
      "email"
    ],
    "mfaConfiguration": "OFF",
    "mfaTypes": [
      "SMS Text Message"
    ],
    "smsAuthenticationMessage": "Your authentication code is {####}",
    "smsVerificationMessage": "Your verification code is {####}",
    "emailVerificationSubject": "Your verification code",
    "emailVerificationMessage": "Your verification code is {####}",
    "defaultPasswordPolicy": false,
    "passwordPolicyMinLength": 8,
    "passwordPolicyCharacters": [],
    "requiredAttributes": [
      "email",
      "family_name",
      "given_name",
      "picture"
    ],
    "aliasAttributes": [],
    "userpoolClientGenerateSecret": false,
    "userpoolClientRefreshTokenValidity": 30,
    "userpoolClientWriteAttributes": [
      "email"
    ],
    "userpoolClientReadAttributes": [
      "email"
    ],
    "userpoolClientLambdaRole": "lighthbfd910c3_userpoolclient_lambda_role",
    "userpoolClientSetAttributes": false,
    "authSelections": "identityPoolAndUserPool",
    "resourceName": "lighthall",
    "serviceName": "Cognito",
    "useDefault": "defaultSocial",
    "sharedId": "bfd910c3",
    "userPoolGroupList": [],
    "userPoolGroups": false,
    "usernameAttributes": [
      "email"
    ],
    "usernameCaseSensitive": false,
    "adminQueries": false,
    "hostedUI": true,
    "hostedUIDomainName": "lighthall4fdd6b2e-4fdd6b2e",
    "hostedUIProviderMeta": "[{\"ProviderName\":\"Facebook\",\"authorize_scopes\":\"email,public_profile\",\"AttributeMapping\":{\"email\":\"email\",\"family_name\":\"last_name\",\"given_name\":\"first_name\",\"picture\":\"picture\",\"username\":\"id\"}},{\"ProviderName\":\"Google\",\"authorize_scopes\":\"openid email profile\",\"AttributeMapping\":{\"email\":\"email\",\"family_name\":\"family_name\",\"given_name\":\"given_name\",\"picture\":\"picture\",\"username\":\"sub\"}}]",
    "authProvidersUserPool": [
      "Facebook",
      "Google"
    ],
    "authProviders": [],
    "triggers": {},
    "authRoleArn": {
      "Fn::GetAtt": [
        "AuthRole",
        "Arn"
      ]
    },
    "unauthRoleArn": {
      "Fn::GetAtt": [
        "UnauthRole",
        "Arn"
      ]
    },
    "breakCircularDependency": true,
    "useEnabledMfas": false,
    "dependsOn": [],
    "googleClientId": "189183163985-vlbrbi5hisj5pdvd5pff13ukmhgj2r7a.apps.googleusercontent.com",
    "parentStack": {
      "Ref": "AWS::StackId"
    },
    "permissions": [],
    "oAuthMetadata": "{\"AllowedOAuthFlows\":[\"code\"],\"AllowedOAuthScopes\":[\"phone\",\"email\",\"openid\",\"profile\",\"aws.cognito.signin.user.admin\"],\"CallbackURLs\":[\"http://localhost:3000/\",\"https://www.lighthall.co/\"],\"LogoutURLs\":[\"http://localhost:3000/\",\"https://www.lighthall.co/\"]}"
  }
}
chrisbonifacio commented 2 years ago

Hi @SaileshKumar 👋 because this issue is more related to hosting, I'm going to transfer this over to the console repo for better support. Thank you for raising this issue!

github-actions[bot] commented 2 years ago

Hi :wave:, thanks for opening! While we look into this...

If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.

Lastly, please make sure you've specified the App ID and Region in the issue!

SaileshKumar commented 2 years ago

Fixed by downgrading the CLI

Locally: npm i @aws-amplify/cli@7.6.8

In Env Variables: _LIVE_UPDATES -> 7.6.8

I'll leave this open for you all to decide if close, or fix in 7.6.9 :)

isaac-rosterlab commented 2 years ago

@SaileshKumar Thanks a lot. I have the same error. The same (temporary) solution worked. #2509

gmicek commented 2 years ago

Fixed by downgrading the CLI

Locally: npm i @aws-amplify/cli@7.6.8

In Env Variables: _LIVE_UPDATES -> 7.6.8

I'll leave this open for you all to decide if close, or fix in 7.6.9 :)

I'm hitting this too. The workaround here from @SaileshKumar worked for us. Steps:

This workaround worked for us. We'll plan to change it later back to latest.

batelhi commented 2 years ago

Im having a build error in amplify console:

2022-01-22T18:11:20.439Z [INFO]: Following resources failed 2022-01-22T18:11:20.440Z [INFO]: Resource Name: eu-west-1 *** (AWS::Cognito::UserPool) Event Type: update Reason: Updates are not allowed for property - UsernameConfiguration. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: null; Proxy: null)

2022-01-22T18:11:20.440Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud

Even though the only change i made was in schema.garphql file. But changing amplify version to 7.6.8 didn't fix my problem...

hanna-becker commented 2 years ago

For me setting these environment variables actually did provide a workaround. AMPLIFY_FACEBOOK_CLIENT_ID AMPLIFY_FACEBOOK_CLIENT_SECRET AMPLIFY_GOOGLE_CLIENT_ID AMPLIFY_GOOGLE_CLIENT_SECRET

It's set to use the latest aws-cli, which should be v7.6.22, atm.

batelhi commented 2 years ago

@swaminator

Still getting the same issue: (@aws-amplify/cli version 7.6.24)

Following resources failed Resource Name: eu-west-1_P2BhinJiq (AWS::Cognito::UserPool) Event Type: update Reason: Updates are not allowed for property - UsernameConfiguration. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: null; Proxy: null) URL: xxx 2022-03-16T17:15:20.732Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud 2022-03-16T17:15:20.732Z [WARNING]: ✖ There was an error initializing your environment.

But I didn't change the property - UsernameConfiguration.

Is it related to #2509 ?

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.