Amplify-cli: amplify push hosting has errror ... TypeError: Cannot read property 'client_id' of undefined

Created on 30 Mar 2020  ยท  5Comments  ยท  Source: aws-amplify/amplify-cli

Describe the bug
When I try to push for amplify hosting. That had error.

UPDATE_FAILED
HostedUIProvidersCustomResourceInputs
Custom::LambdaCallout      Mon Mar 30 2020 18:57:29 GMT+0900 (Japan Standard Time) Failed to update resource. See the details in CloudWatch Log Stream: 2020/03/30/[$LATEST]xxxxxx
UPDATE_ROLLBACK_IN_PROGRESS amplify-xxx-dev-xxxxxx
AWS::CloudFormation::Stack Mon Mar 30 2020 18:57:30 GMT+0900 (Japan Standard Time) The following resource(s) failed to update: [HostedUIProvidersCustomResourceInputs].                                     
โ  Updating resources in the cloud. This may take a few minutes...

UPDATE_FAILED
authxxxxxxxxx
AWS::CloudFormation::Stack Mon Mar 30 2020 18:57:39 GMT+0900 (Japan Standard Time) Embedded stack arn:aws:cloudformation:ap-northeast-1:xxxxxx:stack/amplify-xxxx-dev-202249-authxxxxxxx-xxxxx/xxxxx-1111-11ea-xxxx-xxxxxxxx was not successfully updated. 
Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [HostedUIProvidersCustomResourceInputs]. 
CREATE_FAILED
hostingS3AndCloudFront AWS::CloudFormation::Stack Mon Mar 30 2020 18:57:39 GMT+0900 (Japan Standard Time) Resource creation cancelled                                                                                                                                                                               

Also the cloud watch error is following.

2020-03-30T09:57:27.950Z    xxxx-xxxx-xxxx-xxxx-xxxx
INFO. TypeError: Cannot read property 'client_id' of undefined
    at getRequestParams (/var/task/index.js:1:1053)
    at updateIdentityProvider (/var/task/index.js:1:1635)
    at hostedUIProviderMeta.forEach (/var/task/index.js:1:2373)
    at Array.forEach (<anonymous>)
    at identity.listIdentityProviders.promise.then (/var/task/index.js:1:2249)
    at process._tickCallback (internal/process/next_tick.js:68:7)
{
    "Status": "FAILED",
    "Reason": "See the details in CloudWatch Log Stream: 2020/03/30/[$LATEST]xxxx",
    "PhysicalResourceId": "2020/03/30/[$LATEST]xxxxx",
    "StackId": "arn:aws:cloudformation:ap-northeast-1:xxxxx:stack/amplify-xxx-dev-xxxx-authxxxx-xxxxxx/xxxxx-xxxx-xxxx-xxxx-xxxx",
    "RequestId": "xxxx-xxxxx-xxxx-xxxx-xxxxxx",
    "LogicalResourceId": "HostedUIProvidersCustomResourceInputs",
    "NoEcho": false,
    "Data": {
        "err": {}
    }
}

Amplify CLI Version

$ amplify -v
4.17.2

To Reproduce

$ amplify add hosting
$ amplify status

Current Environment: dev

| Category | Resource name               | Operation | Provider plugin   |
| -------- | --------------------------- | --------- | ----------------- |
| Hosting  | S3AndCloudFront             | Create    | awscloudformation |
| Auth     | xxxxxxx                 | No Change    | awscloudformation |
| Function | xxxxCustomMessage    | No Change | awscloudformation |
| Function | xxxxPostConfirmation | No Change | awscloudformation |
| Function | AdminQueriesxxxxx        | No Change | awscloudformation |
| Auth     | userPoolGroups              | No Change | awscloudformation |
| Api      | xxx                         | No Change | awscloudformation |
| Api      | AdminQueries                | No Change | awscloudformation |
| Storage  | xxxx                  | No Change | awscloudformation |

GraphQL endpoint: https://xxxx.appsync-api.ap-northeast-1.amazonaws.com/graphql
Hosted UI Endpoint: https://xxxx-xxxx-dev.auth.ap-northeast-1.amazoncognito.com/
Test Your Hosted UI Endpoint: https://xxxx-xxxx-dev.auth.ap-northeast-1.amazoncognito.com/login?response_type=code&client_id=xxxx&xxxirect_uri=http://localhost:3000/thankyou/

$ amplify push 
...
UPDATE_FAILED
HostedUIProvidersCustomResourceInputs
Custom::LambdaCallout      Mon Mar 30 2020 18:57:29 GMT+0900 (Japan Standard Time) Failed to update resource. See the details in CloudWatch Log Stream: 2020/03/30/[$LATEST]xxxxxx
UPDATE_ROLLBACK_IN_PROGRESS amplify-xxx-dev-xxxxxx
AWS::CloudFormation::Stack Mon Mar 30 2020 18:57:30 GMT+0900 (Japan Standard Time) The following resource(s) failed to update: [HostedUIProvidersCustomResourceInputs].                                     
โ  Updating resources in the cloud. This may take a few minutes...

UPDATE_FAILED
authxxxxxxxxx
AWS::CloudFormation::Stack Mon Mar 30 2020 18:57:39 GMT+0900 (Japan Standard Time) Embedded stack arn:aws:cloudformation:ap-northeast-1:xxxxxx:stack/amplify-xxxx-dev-xxxxx-authxxxxxxx-xxxxx/xxxxx-1111-11ea-xxxx-xxxxxxxx was not successfully updated. 
Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [HostedUIProvidersCustomResourceInputs]. 
CREATE_FAILED
hostingS3AndCloudFront AWS::CloudFormation::Stack Mon Mar 30 2020 18:57:39 GMT+0900 (Japan Standard Time) Resource creation cancelled   

Expected behavior
I want to deploy amplify hosting with success.

  • Amplify hosting is success
  • Deploy to Nuxtjs with spa mode.

Desktop

  • OS: OSX Mojave 10.14.5 (18F132)
  • Node Version v10.16.3
platform question

Most helpful comment

I was able to figure it out.

We were using two environments: dev and prod. The prod environment was missing the Facebook credentials in amplify/team-provider-info.json, only the dev one had it.

So:

"prod": {
        "awscloudformation": {
            ...
        },
        "categories": {
            "auth": {
                "XXXXXXXXXXXXXXX": {
                    "hostedUIProviderCreds": "[{\"ProviderName\":\"Facebook\",\"client_id\":\"XXXXXXX\",\"client_secret\":\"XXXXX\"}]"
                }
            },

The above was needed, it was initially an empty array [].

All 5 comments

Just running amplify push instead of amplify hosting push should solve the issue. Can you please try that?

@kaustavghosh06 Thank you for reply.
I tried that but I got same error...

$ amplify hosting push
...
UPDATE_FAILED               HostedUIProvidersCustomResourceInputs                Custom::LambdaCallout      Tue Mar 31 2020 13:13:40 GMT+0900 (Japan Standard Time) Failed to update resource. See the details in CloudWatch Log Stream: 2020/03/31/[$LATEST]xxxxxx

UPDATE_FAILED               authxxxxxxx        AWS::CloudFormation::Stack Tue Mar 31 2020 13:13:49 GMT+0900 (Japan Standard Time) Embedded stack arn:aws:cloudformation:ap-northeast-1:xxxxx:stack/amplify-xxx-dev-xxxx-authxxxxx-xxxxxx/xxxxxx-xxxx-xxxx-xxxx-xxxxxx was not successfully updated. Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [HostedUIProvidersCustomResourceInputs]. 
CREATE_FAILED               hostingS3AndCloudFront AWS::CloudFormation::Stack Tue Mar 31 2020 13:13:49 GMT+0900 (Japan Standard Time) Resource creation cancelled  

cloud watch log.

2020-03-31T04:13:38.849Z    xxxx-xxxx-xxxx-xxxx-xxxxxx  INFO    TypeError: Cannot read property 'client_id' of undefined
    at getRequestParams (/var/task/index.js:1:1053)
    at updateIdentityProvider (/var/task/index.js:1:1635)
    at hostedUIProviderMeta.forEach (/var/task/index.js:1:2373)
    at Array.forEach (<anonymous>)
    at identity.listIdentityProviders.promise.then (/var/task/index.js:1:2249)
    at process._tickCallback (internal/process/next_tick.js:68:7)
2020-03-31T04:13:38.850Z    a2341d3a-4a55-4570-ae06-bcff9a692cb4    INFO    Response body:

{
    "Status": "FAILED",
    "Reason": "See the details in CloudWatch Log Stream: 2020/03/31/[$LATEST]xxxxxx",
    "PhysicalResourceId": "2020/03/31/[$LATEST]xxxxxx",
    "StackId": "arn:aws:cloudformation:ap-northeast-1:xxx:stack/amplify-xxx-dev-xxxx-authrxxxx-xxxx/xxxxx-xxxx-xxxx-xxxx-xxxxx",
    "RequestId": "xxxxxx-xxxx-xxxx-xxxx-xxxx",
    "LogicalResourceId": "HostedUIProvidersCustomResourceInputs",
    "NoEcho": false,
    "Data": {
        "err": {}
    }
}

I have multiple github repositories and these are using same amplify cloud formation.
(customer, admin)

I can't across to use multiple github repositories when I use amplify?

@kaustavghosh06 I'm having the exact same problem. I'm running amplify push because this is a React Native app. Notice that the failure is this:

TypeError: Cannot read property 'client_id' of undefined

And is related to a cloud formation update of HostedUIProvidersCustomResourceInputs, and it also started occuring after adding Facebook federation to Cognito.

Something seems to be missing. Any ideas what it could be?

I was able to figure it out.

We were using two environments: dev and prod. The prod environment was missing the Facebook credentials in amplify/team-provider-info.json, only the dev one had it.

So:

"prod": {
        "awscloudformation": {
            ...
        },
        "categories": {
            "auth": {
                "XXXXXXXXXXXXXXX": {
                    "hostedUIProviderCreds": "[{\"ProviderName\":\"Facebook\",\"client_id\":\"XXXXXXX\",\"client_secret\":\"XXXXX\"}]"
                }
            },

The above was needed, it was initially an empty array [].

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kstro21 picture kstro21  ยท  3Comments

onlybakam picture onlybakam  ยท  3Comments

kangks picture kangks  ยท  3Comments

MageMasher picture MageMasher  ยท  3Comments

nicksmithr picture nicksmithr  ยท  3Comments