When using CDK to deploy Amplify, the Production Branch field is not being populated. Production Branch also does not populate after successful build. I cannot find anywhere in the documentation where ProductionBranch can be defined. This is the closest documentation i could find: Amplify API.
I also tried with the aws_amplify package for cdk2.0 as well.
Reproduction Steps
Deploy Amplify App using GitHub repo as the provider.
Code I am using:
import * as cdk from "aws-cdk-lib";
import * as amplify from '@aws-cdk/aws-amplify-alpha';
import { Construct } from "constructs";
export interface CdkInfraStack extends cdk.StackProps {
owner: string;
repository: string;
role: string;
domain: string;
}
export class AmplifyInfraStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: CdkInfraStack) {
super(scope, id, props);
// Amplify Application
const amplifyApp = new amplify.App(this, "next-js-amplify", {
sourceCodeProvider: new amplify.GitHubSourceCodeProvider({
owner: props.owner,
repository: props.repository,
oauthToken: cdk.SecretValue.secretsManager("github/pat/crs-k", {
jsonField: "githubPat",
}),
}),
role: cdk.aws_iam.Role.fromRoleArn(this,'service-role',props.role) // necessary for explictly defining a service role that can create other resources as needed.
});
const main = amplifyApp.addBranch("main", {autoBuild: true});
const domain = amplifyApp.addDomain(props.domain, {
enableAutoSubdomain: true, // subdomains auto registered for branches
autoSubdomainCreationPatterns: ['*'], // regex for branches that should auto registered as subdomains
});
domain.mapRoot(main); // map main branch to domain root
domain.mapSubDomain(main, 'www');
}
}
What did you expect to happen?
Production Branch field to be populated with addBranch or default branch name.
What is the problem?
When using CDK to deploy Amplify, the Production Branch field is not being populated. Production Branch also does not populate after successful build. I cannot find anywhere in the documentation where ProductionBranch can be defined. This is the closest documentation i could find: Amplify API.
I also tried with the aws_amplify package for cdk2.0 as well.
Reproduction Steps
Deploy Amplify App using GitHub repo as the provider.
Code I am using:
What did you expect to happen?
Production Branch field to be populated with addBranch or default branch name.
What actually happened?
Production Branch field was unpopulated.
CDK CLI Version
2.10.0
Framework Version
No response
Node.js Version
17.3
OS
windows & ubuntu
Language
Typescript
Language Version
4.5.5
Other information
No response