aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 820 forks source link

@aws-amplify/cli@4.23.1 breaks build: Failed to pull the backend. auth headless is missing the following inputParams facebookAppIdUserPool, facebookAppSecretUserPool, googleAppIdUserPool, googleAppSecretUserPool #4790

Closed bwalsh closed 4 years ago

bwalsh commented 4 years ago

Describe the bug Version change broke our production deploy

Amplify CLI Version @aws-amplify/cli@4.23.1

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 merge-graphql-schemas@1.7.8: 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/common@0.10.4: 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/common@0.6.6: 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/common@0.9.7: 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 core-js@2.6.11: 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 graphql-import@0.7.1: 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 request@2.88.2: 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]: > core-js@3.6.5 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]: > core-js@2.6.11 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]: > core-js-pure@3.6.5 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]: > ejs@3.1.3 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/cli@4.23.1 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 fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
                                    npm WARN inquirer-autocomplete-prompt@1.0.2 requires a peer of inquirer@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
                                    npm WARN ws@7.3.1 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]: ws@7.3.1 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/cli@4.23.1
                                 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

bwalsh commented 4 years ago

workaround: fallback to 4.21.3

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

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

jasonergle commented 4 years ago

I am suddenly getting the same error.

davidmfox commented 4 years ago

yep me too

SwaySway commented 4 years ago

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

davidmfox commented 4 years ago

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_ID
AMPLIFY_AMAZON_CLIENT_SECRET
AMPLIFY_FACEBOOK_CLIENT_ID
AMPLIFY_FACEBOOK_CLIENT_SECRET
AMPLIFY_GOOGLE_CLIENT_ID
AMPLIFY_GOOGLE_CLIENT_SECRET
bwalsh commented 4 years ago

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

@SwaySway Yes. We use the HostedUI

bwalsh commented 4 years ago

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.

geoseong commented 4 years ago

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

geoseong commented 4 years ago

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

SwaySway commented 4 years ago

@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.

nipoonp commented 4 years ago

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_ID
AMPLIFY_AMAZON_CLIENT_SECRET
AMPLIFY_FACEBOOK_CLIENT_ID
AMPLIFY_FACEBOOK_CLIENT_SECRET
AMPLIFY_GOOGLE_CLIENT_ID
AMPLIFY_GOOGLE_CLIENT_SECRET

Worked for me!

karrettgelley commented 4 years ago

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"}]
mjza commented 3 years ago

@nipoonp

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

AMPLIFY_AMAZON_CLIENT_ID
AMPLIFY_AMAZON_CLIENT_SECRET
AMPLIFY_FACEBOOK_CLIENT_ID
AMPLIFY_FACEBOOK_CLIENT_SECRET
AMPLIFY_GOOGLE_CLIENT_ID
AMPLIFY_GOOGLE_CLIENT_SECRET
github-actions[bot] commented 3 years ago

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

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.