Amplify-cli: @aws-amplify/[email protected] breaks build: Failed to pull the backend. auth headless is missing the following inputParams facebookAppIdUserPool, facebookAppSecretUserPool, googleAppIdUserPool, googleAppSecretUserPool

Created on 10 Jul 2020  Â·  14Comments  Â·  Source: aws-amplify/amplify-cli

Describe the bug
Version change broke our production deploy

Amplify CLI Version
@aws-amplify/[email protected]

To Reproduce

  phases:     phases:
    build:      build:
      commands:
        - npm install -g @aws-amplify/cli
        - amplify pull --providers '{"awscloudformation":{"configLevel":"project","useProfile":true,"profileName":"default"}}' --appId ${BACKEND_APP_ID} --envName ${BACKEND_APP_ENV} --yes

Expected behavior
The pull command to complete

Screenshots

                                 # Starting phase: build
                                 # Executing command: npm install -g @aws-amplify/cli
2020-07-09T22:44:32.415Z [WARNING]: npm WARN deprecated [email protected]: Merge GraphQL Schemas has been deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-merge-graphql-schemas for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes.
2020-07-09T22:44:33.527Z [WARNING]: npm WARN deprecated @graphql-toolkit/[email protected]: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes.
2020-07-09T22:44:35.114Z [WARNING]: npm WARN deprecated @graphql-toolkit/[email protected]: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes.
2020-07-09T22:44:35.673Z [WARNING]: npm WARN deprecated @graphql-toolkit/[email protected]: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes.
2020-07-09T22:44:39.326Z [WARNING]: npm WARN
2020-07-09T22:44:39.328Z [WARNING]: deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
2020-07-09T22:44:41.184Z [WARNING]: npm WARN deprecated [email protected]: GraphQL Import has been deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-import for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes.
2020-07-09T22:44:43.483Z [WARNING]: npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
2020-07-09T22:44:59.670Z [INFO]: /root/.nvm/versions/node/v10.16.0/bin/amplify -> /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/bin/amplify
2020-07-09T22:44:59.748Z [INFO]: > [email protected] postinstall /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-graphql-types-generator/node_modules/core-js
                                 > node -e "try{require('./postinstall')}catch(e){}"
2020-07-09T22:44:59.811Z [INFO]: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
                                 The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
                                 > https://opencollective.com/core-js 
                                 > https://www.patreon.com/zloirock 
                                 Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
2020-07-09T22:44:59.820Z [INFO]: > [email protected] postinstall /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/core-js
                                 > node -e "try{require('./postinstall')}catch(e){}"
2020-07-09T22:44:59.882Z [INFO]: > [email protected] postinstall /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/core-js-pure
                                 > node -e "try{require('./postinstall')}catch(e){}"
2020-07-09T22:44:59.986Z [INFO]: > [email protected] postinstall /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/ejs
                                 > node --harmony ./postinstall.js
2020-07-09T22:45:00.045Z [INFO]: Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
2020-07-09T22:45:00.049Z [INFO]: > @aws-amplify/[email protected] postinstall /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli
                                 > node scripts/post-install.js
2020-07-09T22:45:00.225Z [INFO]: 
2020-07-09T22:45:00.227Z [INFO]: ----------------------------------------
2020-07-09T22:45:00.227Z [INFO]: Successfully installed the Amplify CLI
                                 ----------------------------------------
                                 JavaScript Getting Started - https://docs.amplify.aws/start
                                 Android Getting Started - https://docs.amplify.aws/start/q/integration/android
                                 iOS Getting Started - https://docs.amplify.aws/start/q/integration/ios
2020-07-09T22:45:00.239Z [WARNING]: npm
2020-07-09T22:45:00.239Z [WARNING]: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/@aws-amplify/cli/node_modules/chokidar/node_modules/fsevents):
                                    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
                                    npm WARN [email protected] requires a peer of inquirer@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
                                    npm WARN [email protected] requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
                                    npm WARN
2020-07-09T22:45:00.240Z [WARNING]: [email protected] requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
2020-07-09T22:45:00.241Z [INFO]: + @aws-amplify/[email protected]
                                 added 397 packages from 212 contributors, removed 1555 packages, updated 297 packages and moved 65 packages in 40.275s
2020-07-09T22:45:00.271Z [INFO]: # Executing command: amplify pull --providers '{awscloudformation:{configLevel:project,useProfile:true,profileName:default}}' --appId XXXXXXxjq1 --envName prod --yes
2020-07-09T22:45:01.060Z [INFO]: Scanning for plugins...
2020-07-09T22:45:01.096Z [INFO]: Plugin scan successful
2020-07-09T22:45:05.270Z [INFO]: For more information on AWS Profiles, see:
2020-07-09T22:45:05.271Z [INFO]: https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html
2020-07-09T22:45:05.934Z [INFO]: Amplify AppID found: XXXXXXxjq1. Amplify App name is: XXX-prod
2020-07-09T22:45:06.125Z [INFO]: Backend environment prod found in Amplify Console app: XXX-prod
2020-07-09T22:45:06.269Z [INFO]: 
2020-07-09T22:45:06.270Z [WARNING]: - Fetching updates to backend environment: prod from the cloud.
2020-07-09T22:45:06.797Z [WARNING]: ✖ There was an error pulling the backend environment prod.
2020-07-09T22:45:06.798Z [INFO]: Failed to pull the backend.
                                 auth headless is missing the following inputParams facebookAppIdUserPool, facebookAppSecretUserPool, googleAppIdUserPool, googleAppSecretUserPool
2020-07-09T22:45:06.799Z [INFO]: Error: auth headless is missing the following inputParams facebookAppIdUserPool, facebookAppSecretUserPool, googleAppIdUserPool, googleAppSecretUserPool
                                 at updateConfigOnEnvInit (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/provider-utils/awscloudformation/index.js:370:15)
                                 at /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/index.js:240:28
                                 at /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/promise-sequential/index.js:16:18
                                 at process._tickCallback (internal/process/next_tick.js:68:7)
2020-07-09T22:45:06.811Z [ERROR]: !!! Build failed
2020-07-09T22:45:06.923Z [ERROR]: !!! Non-Zero Exit Code detected
2020-07-09T22:45:06.924Z [INFO]: # Starting environment caching...
2020-07-09T22:45:06.924Z [INFO]: # Environment caching completed
Terminating logging...

Desktop (please complete the following information):
NA default build container

pending-triage platform

Most helpful comment

My fix:

    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple

Then in the Amplify console add the environment variables:

AMPLIFY_AMAZON_CLIENT_SECRET
AMPLIFY_FACEBOOK_CLIENT_ID
AMPLIFY_FACEBOOK_CLIENT_SECRET
AMPLIFY_GOOGLE_CLIENT_ID
AMPLIFY_GOOGLE_CLIENT_SECRET

All 14 comments

workaround: fallback to 4.21.3

    build:
      commands:
        - npm install -g @aws-amplify/[email protected]
        - amplify pull --providers '{"awscloudformation":{"configLevel":"project","useProfile":true,"profileName":"default"}}' --appId ${BACKEND_APP_ID} --envName ${BACKEND_APP_ENV} --yes

Hello @bwalsh
Do you have HostedUI setup in your project?

I am suddenly getting the same error.

yep me too

Previous builds with the CLI would fail on a push as the social provider credentials were not available in the project on doing a pull. This was an issue in #3642 by adding those hosted credentials on a pull this would avoid a failed push.
You can provide the social credentials using this example here: https://github.com/aws-amplify/amplify-cli/issues/3642#issuecomment-655804757

Ref Issues
https://github.com/aws-amplify/amplify-cli/issues/3642
https://github.com/aws-amplify/amplify-console/issues/206

My fix:

    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple

Then in the Amplify console add the environment variables:

AMPLIFY_AMAZON_CLIENT_SECRET
AMPLIFY_FACEBOOK_CLIENT_ID
AMPLIFY_FACEBOOK_CLIENT_SECRET
AMPLIFY_GOOGLE_CLIENT_ID
AMPLIFY_GOOGLE_CLIENT_SECRET

Hello @bwalsh
Do you have HostedUI setup in your project?

@SwaySway Yes. We use the HostedUI

Puzzled. Why client id's and secrets needed when they already exist in cognito? Thought the point of pull was to retrieve that from stack. Our build simply deploys the app, does not make changes to auth.

same here. my temp solution was to downgrade cli version to 4.20. and I also submitted the issue #4806.

I finally resolved that issue. even though it is temp fix... here is my comment in issue

@bwalsh Correct though to change credentials we expose this value. We realize this workflow isn't convenient as you would need to resend the credentials. In the long term we are looking at changing this, as noted in https://github.com/aws-amplify/amplify-console/issues/206#issuecomment-649046388.

Closing this issue. Should you experience any other issues related to the auth config on the CLI please comment below to re-open.

My fix:

    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple

Then in the Amplify console add the environment variables:

AMPLIFY_AMAZON_CLIENT_SECRET
AMPLIFY_FACEBOOK_CLIENT_ID
AMPLIFY_FACEBOOK_CLIENT_SECRET
AMPLIFY_GOOGLE_CLIENT_ID
AMPLIFY_GOOGLE_CLIENT_SECRET

Worked for me!

Same issue. Using social federation with facebook, google, and amazon. Never had this issue until upgrading recently. I believe it was 4.22 that broke my code. The credentials were properly set up through the cli and have not changed since. I have CD set up through the amplify console. Again, not sure why my pushes are failing now since they never have before. If anyone could elaborate on whether or not this will be fixed, or if in fact this is not a bug, that'd be great

edit: I was able to temporarily fix this issue in a similar way as @bwalsh
I simply edited the _LIVE_UPDATES environment variable in the environment variables tab of the amplify console

Before

_LIVE_UPDATES [{"name":"Amplify CLI","pkg":"@aws-amplify/cli","type":"npm","version":"latest"}]

After

_LIVE_UPDATES [{"name":"Amplify CLI","pkg":"@aws-amplify/cli","type":"npm","version":"4.21.3"}]

@nipoonp

Hi there, how did you generate the values for the following variables?

AMPLIFY_AMAZON_CLIENT_SECRET
AMPLIFY_FACEBOOK_CLIENT_ID
AMPLIFY_FACEBOOK_CLIENT_SECRET
AMPLIFY_GOOGLE_CLIENT_ID
AMPLIFY_GOOGLE_CLIENT_SECRET
Was this page helpful?
0 / 5 - 0 ratings

Related issues

amlcodes picture amlcodes  Â·  3Comments

nicksmithr picture nicksmithr  Â·  3Comments

MageMasher picture MageMasher  Â·  3Comments

darrentarrant picture darrentarrant  Â·  3Comments

jkeys-ecg-nmsu picture jkeys-ecg-nmsu  Â·  3Comments