Description
My application is using AppSync and it is multienv. The aws-exports.js is ignored from the Git so when the deployment is triggered by the change in Bitbucket, the amplify configuration is auto-generated internally from the Amplify console during the build. The aws_appsync_authenticationType is missing and the frontend will use AWS_IAM as default instead of AMAZON_COGNITO_USER_POOLS (my local config).
To Reproduce
Steps to reproduce the behavior:
aws-exports.js is not committed to the GITRequest headers:

Expected behavior
Detect API default authentication method and set aws_appsync_authenticationType to correct value. In my case, use AMAZON_COGNITO_USER_POOLS
@Cas-Laputa , thanks for reporting this. We'll look into this issue for you.
Any updates on this? I am facing the same problem. Deploying from the CLI works fine, I can sign in, query and do mutations. Deploying from Amplify console gives me the above error. I can sign in fine but get a 401 "UnauthorizedException - Unable to parse JWT" token when trying to access the api.
Any updates on this? I am facing the same problem. Deploying from the CLI works fine, I can sign in, query and do mutations. Deploying from Amplify console gives me the above error. I can sign in fine but get a 401 "UnauthorizedException - Unable to parse JWT" token when trying to access the api.
You can workaround this issue until this is improved:
Amplify.configure({
...awsconfig,
aws_appsync_authenticationType: 'AMAZON_COGNITO_USER_POOLS',
});
@Cas-Laputa That seemed to get me past the first hurdle, but now getting:
"Validation error of type FieldUndefined: Field 'owner' in type '[model]' is undefined @ 'list[model]s/items/owner"
Same goes for the mutations. Did you run into that as well?
UPDATE:
Adding
owner: String
to all the schema models seemed to fix that error, but soon after another one popped up which probably belongs in a separate thread.
There generally seems to be a mismatch between the local Amplify CLI compile/deploy process and the Amplify Console compile/deploy process. The Cognito auth seems to be mapped correctly to all the schema/models/resolvers from the CLI but not the console. Needing the console for a production deployment pipeline and not wanting to add any more patch code to get it to work.
Wondering if anyone has found the missing link to getting this to work as intended?
Was able to reproduce the issue. Looks like there's an issue with the generation of the aws-exports.js file in the headless state. We are investigating a fix. For now as a workaround, try building locally and uploading the artifacts manually: https://docs.aws.amazon.com/amplify/latest/userguide/manual-deploys.html
Update: Turns out its because there is a version mismatch between the Console and the CLI. You can set the version of the CLI to the latest here: https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-image.html#setup-live-updates
Please verify this works for you.
Update: Turns out its because there is a version mismatch between the Console and the CLI. You can set the version of the CLI to the latest here: https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-image.html#setup-live-updates
Please verify this works for you.
It works.
@swaminator Setting the latest Amplify-cli has caused another build error:
Parameters: [unauthRoleName, authRoleName] do not exist in the template
@Cas-Laputa I see you came across https://github.com/aws-amplify/amplify-console/issues/10#issuecomment-534787729
Will close this issue and provide additional updates there.
Thank goodness I found this ticket, after a lot of searching. It still seems necessary to set this "live updates" setting for the aws-exports.js to be generated properly during a console build. Is there a non-closed bug tracking a fix so the console build environment actually works out of the box, or should I open one?
Update: It is still necessary today to set live updates to "latest" or else you are using the broken amplify CLI version that silently swallows aws_appsync_authenticationType.

It is confusing to me, that this ticket is closed while the default state of the amplify build environment is broken. Is there another place to open an issue for using the fixed version of the tool by default?
Shouldn't Amplify CLI: "latest" be the default? This is confusing, if you want a specific version then you should pin it. But it sure seems like latest should be the default.