Describe the bug
Build using - amplifyPush --environment $AWS_BRANCH in amplify.yml generates Error: auth headless init is missing the following inputParams googleClientId, facebookAppId while working with amplify push using amplify CLI.
To Reproduce
Steps to reproduce the behavior:
version: 0.9
backend:
phases:
preBuild:
commands:
# Test Get Amplify CLI Cloud-Formation stack info from environment cache
- export STACKINFO="$(envCache --get stackInfo)"
build:
commands:
- echo "printing env"
- env
# Execute Amplify CLI with the helper script
- amplifyPush --environment $AWS_BRANCH
postBuild:
commands:
# Store Amplify CLI CloudFormation stack info in environment cache
- envCache --set stackInfo "$(amplify env get --json --name $AWS_BRANCH)"
{
"prod": {
"categories": {
"auth": {
"Cognito": {
"facebookAppId": "xxxx",
"googleClientId": "xxxxx"
}
}
}
}
}
git push to kick the build process# Executing command: amplifyPush --environment master
2019-01-06T02:59:10.121Z [INFO]: # Start initializing Amplify environment: master
2019-01-06T02:59:10.124Z [INFO]: # Initializing new Amplify environment: master (amplify init)
....
2019-01-06T01:59:24.985Z [WARNING]: ✔ Successfully created initial AWS cloud resources for deployments.
2019-01-06T01:59:25.123Z [WARNING]: - Initializing your environment: master
2019-01-06T01:59:25.125Z [WARNING]: ✔ Initialized provider successfully.
2019-01-06T01:59:25.134Z [WARNING]: ✖ There was an error initializing your environment.
2019-01-06T01:59:25.134Z [INFO]: init failed
2019-01-06T01:59:25.137Z [INFO]: Error: auth headless init is missing the following inputParams googleClientId, facebookAppId
at updateConfigOnEnvInit (/root/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/provider-utils/awscloudformation/index.js:237:15)
at /root/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/index.js:200:28
at /root/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/promise-sequential/index.js:16:18
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
2019-01-06T01:59:25.142Z [ERROR]: !!! Build failed
2019-01-06T01:59:25.142Z [ERROR]: !!! Non-Zero Exit Code detected
I also tried to populate the keys using Amplify Console Environment variables with:
googleClientId and prod.categories.auth.Cognito. googleClientId as well as populating FACEBOOK_APP_ID and GOOGLE_CLIENT_ID per https://github.com/aws-amplify/amplify-cli/issues/572 without help
When executing amplify push using CLI the error does not occuring
Expected behavior
Succesfull build
You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = 'DEBUG'; in your app.
@yahavb As you can see in your logs the environment getting created is master (based on your git branch name), so the changes to your prod env in team-provider-info.json won't be picked up by the master env. You can either modify the build command to amplifyPush --environment prod (in that case your existing stack would be re-used -make sure you're deploying in the same region) or modify the amplify/team-provider-info.json to include the master env block with the appropriate client ID's.
Thanks, the prod/master labels are not the issue. I did it by mistake when I submitted the issue because I tried different variation of team-provider-info.json. I don't know what happen but it is now working as expected so I believe something was fixed and my amplify console app is happy.
Im not sure whats going on but my environment initialization is failing
✖ There was an error initializing your environment.
init failed
I encounter this problem quite frequently, I am using prod environment.
It is working fine from my local machine and I don't understand why I get "getting stack from env cache" line even though I am reseting my environment cache.
2019-11-25T16:28:56.016Z [INFO]: # Executing command: amplifyPush --environment prod
2019-11-25T16:28:56.020Z [INFO]: # Getting Amplify CLI Cloud-Formation stack info from environment cache
2019-11-25T16:28:56.026Z [INFO]: # Start initializing Amplify environment: prod
2019-11-25T16:28:56.028Z [INFO]: # Initializing new Amplify environment: prod (amplify init)
2019-11-25T16:29:16.860Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2019-11-25T16:29:21.331Z [WARNING]: - Initializing your environment: prod
2019-11-25T16:29:21.786Z [WARNING]: ✔ Initialized provider successfully.
2019-11-25T16:29:21.832Z [WARNING]: ✖ There was an error initializing your environment.
2019-11-25T16:29:21.833Z [INFO]: init failed
2019-11-25T16:29:21.834Z [INFO]: Error: auth headless init 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:315:15)
at /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/index.js:241: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)
2019-11-25T16:29:21.908Z [ERROR]: !!! Build failed
2019-11-25T16:29:21.909Z [ERROR]: !!! Non-Zero Exit Code detected
2019-11-25T16:29:21.909Z [INFO]: # Starting environment caching...
2019-11-25T16:29:21.909Z [INFO]: # Environment caching completed
My backend build file
version: 0.1
backend:
phases:
preBuild:
commands:
- 'cd packages/backend/'
- echo "printing dir"
- pwd
build:
commands:
- echo "printing dir"
- pwd
- '# Execute Amplify CLI with the helper script'
- envCache --set stackInfo ""
- amplifyPush --environment prod --simple
commands:
- 'cd ../../'
Hi,
I'm getting exactly the same error. Let me know if you might find a resolution for this issue.
Thanks, Dan
Include googleAppIdUserPool and googleAppSecretUserPool in auth categories flag.
amplify init \
--amplify "{\"envName\":\"dev\"}" \
--categories "{\"auth\":{\"googleAppIdUserPool\":\"googleAppId\",\"googleAppSecretUserPool\":\"googleAppSecret\"}}" \
--yes
Most helpful comment
Hi,
I'm getting exactly the same error. Let me know if you might find a resolution for this issue.
Thanks, Dan