I encounter this problem quite frequently(Until now I used to delete my app), 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 ../../'
@dahersoftware I had the same issue, the console team are working on a fix, for a temporary workaround, see this comment https://github.com/aws-amplify/amplify-console/issues/206#issuecomment-552548466
My issue went away once the build restarted after a push (Earlier it was not , I am not sure what exactly fixed the issue.). I didn't try workaround @Jkap7788 mentioned.
FWIW, I'm having this same issue.
I'm seeing:
Error: auth headless init is missing the following inputParams googleClientId, 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:367:15)
...
...
This started happening after I added a second test environment to my project.
For what it's worth, pushing manually (e.g. amplify push) does not cause any issues, and as far as I know I am correctly supplying all of the required information (but maybe not?).
FWIW, my team-provider-info.json looks something like this:
...
...
"master: {
...
}
...
"test": {
"awscloudformation": {
"AuthRoleName": "amplify-myproject-test-842928-authRole",
"UnauthRoleArn": "arn:aws:iam::98482482723:role/amplify-myproject-test-842928-unauthRole",
"AuthRoleArn": "arn:aws:iam::98482482723:role/amplify-myproject-test-842928-authRole",
"Region": "us-west-2",
"DeploymentBucketName": "amplify-myproject-test-842928-deployment",
"UnauthRoleName": "amplify-myproject-test-842928-unauthRole",
"StackName": "amplify-myproject-test-842928",
"StackId": "arn:aws:cloudformation:us-west-2:98482482723:stack/amplify-myproject-test-842928/asdfasdf124-as-123-sdfasdfas-23423dsf4"
},
"categories": {
"auth": {
"myproject2939da8": {
"hostedUIProviderCreds": "[{\"ProviderName\":\"Google\",\"client_id\":\"asldkjasfo9u3as-asdfjsafasdf.apps.googleusercontent.com\",\"client_secret\":\"xxx\"}]",
"googleClientId": "asldkjasfo9u3as-asdfjsafasdf.apps.googleusercontent.com"
}
},
"function": {
"configurations": {},
"myproject2939da8PreSignup": {
"DOMAINWHITELIST": "testdomain.com",
"VALIDEMAILS": "[email protected]"
},
"myproject2939da8PostAuthentication": {},
"myproject2939da8PreAuthentication": {}
}
}
}
...
...
@dahersoftware did you manage to figure out what hte issue was by chance?
In my case, I have three environments: master, test, and local - all three are configured with different Google credentials I generated w/ the google developer console (basically this bit looks different for each environment in my team-provider-info.json file:
...
"hostedUIProviderCreds": "[{\"ProviderName\":\"Google\",\"client_id\":\"asldkjasfo9u3as-asdfjsafasdf.apps.googleusercontent.com\",\"client_secret\":\"xxx\"}]",
"googleClientId": "asldkjasfo9u3as-asdfjsafasdf.apps.googleusercontent.com"
...
I used amplify-cli to generate all of these configurations.
I'm able to "amplify push" and "amplify publish" with all three environments (after amplify env checkout _____), and they all seem to "work".
That said, when I use the Amplify console to automatically build to these environments on commit, they are now failing with the messages (missing configuration values). I'm curious if you think it was a timing issue of some sort (?) or if you have any clue about how it resolved itself?
My initial master environment WAS working, but now that I've added multiple environments it seems to be failing.
@Jkap7788 when you say that the team is aware and is working on a fix, do you have any more info on that? I went to the issue you called out but didn't see anything specific (maybe I just missed it). I saw the workaround, but I'd prefer not to go down that route as I've got enough things I'm juggling in my head at the moment ;).
Thank you!!
@kevin-mitchell we have a known issue that we're working on resolving. In the meantime have you tried the workaround described here? https://github.com/aws-amplify/amplify-console/issues/206#issuecomment-552548466
Let me know if this doesn't work for you. Also please scrub your comments to remove your googleClientId creds and rotate that key since this is a public forum. (Edit - I scrubbed them for you, please rotate the key)
@kahdojay I _have_ seen the workaround, to be honest part of the reason I've held off is because it wasn't clear to me if the issue was caused by something I was doing incorrectly, vs an actual known issue. It sounds pretty clear that in fact this is a "real" issue.
I will try to give the workaround a shot. Another part of the reason I didn't just jump right in is because I wasn't entirely sure about which parts of the "workaround" needed to be edited, vs which could be copy-pasted. For example
AUTHCONFIG="{\
\"facebookAppIdUserPool\":\"888888888888888\",\
\"facebookAppSecretUserPool\":\"88888888888888888\"\
}"
Is that a "insert your credential here" area? If so, how would I specify different environments for example (I have different Google credentials for my local, test, and master environments)? To somebody who really knows what they are doing this might be obvious, but for me it's unclear.
BTW, those credentials should have already been scrubbed :) - I scrubbed them before posting!
@kevin-mitchell Ah ok, apologies I didn't look closely enough at the secret value. That is indeed an insert-your-credentials area. One idea might be to leverage the AWS_BRANCH environment variable provided by Amplify
For example: https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html#branch-specific-build-settings
(since this is a workaround we don't have a formal recommendation around this, we're trying to focus on fixing the underlying problem).
@kahdojay thank you so much for taking the time to reply to my questions and the ticket / issue. I'll take a look and likely give the workaround a shot.
That said, I'm sure you don't have a timeline for this, but can you give any insight into if this is something that is actively being looked at vs being deep in the backlog? A big part of the reason I went with Amplify vs "roll your own" stack is because it's turnkey, and (as lazy as this sounds) using Amplify allowed me to be ignorant about certain portions of my application / infrastructure. If this was going to be fixed in the next few weeks or even months I might just ignore the problem for now, and give the auto-deployment feature another shot in a few weeks / months.
Finally, I'm assuming #206 is the best place to track this issue? Or is there another ticket that I should watch?
Thanks again!
@kevin-mitchell This is something that is at the top of our backlog and we are actively working on. I'll close this in favor of #206.
I just had the same issue and I found a neat solution
modify your amplify.yml and add
- amplifyPush -e $AWS_BRANCH --simple
after npm ci
Most helpful comment
@dahersoftware did you manage to figure out what hte issue was by chance?
In my case, I have three environments:
master,test, andlocal- all three are configured with different Google credentials I generated w/ the google developer console (basically this bit looks different for each environment in myteam-provider-info.jsonfile:I used amplify-cli to generate all of these configurations.
I'm able to "amplify push" and "amplify publish" with all three environments (after
amplify env checkout _____), and they all seem to "work".That said, when I use the Amplify console to automatically build to these environments on commit, they are now failing with the messages (missing configuration values). I'm curious if you think it was a timing issue of some sort (?) or if you have any clue about how it resolved itself?
My initial
masterenvironment WAS working, but now that I've added multiple environments it seems to be failing.@Jkap7788 when you say that the team is aware and is working on a fix, do you have any more info on that? I went to the issue you called out but didn't see anything specific (maybe I just missed it). I saw the workaround, but I'd prefer not to go down that route as I've got enough things I'm juggling in my head at the moment ;).
Thank you!!