aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.57k stars 3.88k forks source link

[aws-amplify] Creating an Amplify app fails to run build, manual intervention needed. #9479

Open thisismydesign opened 4 years ago

thisismydesign commented 4 years ago

Creating an Amplify app fails to run build, manual intervention needed. Running it manually works.

Reproduction Steps

    const amplifyApp = new amplify.App(this, 'XXX', {
      sourceCodeProvider: new amplify.GitHubSourceCodeProvider({
        owner: 'XXX',
        repository: 'XXX',
        oauthToken: cdk.SecretValue.plainText(process.env.PAT as string)
      }),
    });
    const master = amplifyApp.addBranch('master');
    amplifyApp.addCustomRule(amplify.CustomRule.SINGLE_PAGE_APPLICATION_REDIRECT);
    const domain = amplifyApp.addDomain('XXX');
    domain.mapRoot(master);
    domain.mapSubDomain(master, 'www');

amplify.yml is repo

What did you expect to happen?

Amplify app goes live.

What actually happened?

On the Amplify console I can see the first build never being triggered:

image

Environment

Other


This is :bug: Bug Report

MrArnoldPalmer commented 4 years ago

@jogold Is this a hole in Amplify's cfn features? Will it take a custom resource or something else to auto-trigger a build on resource first deployment? I'm surprised this is the case.

jogold commented 4 years ago

https://aws.amazon.com/blogs/mobile/deploy-a-vuejs-app-with-aws-amplify-console-using-cloudformation/

After deploying the CloudFormation template, you need to go into the Amplify Console and trigger a build. The CloudFormation template can provision the resources, but can’t trigger a build since it creates resources but cannot trigger actions.

A commit should trigger a build.

schnells commented 2 years ago

Facing the same problem today. As its seems there are no updates yet, how can we automate the step?

bobveringa commented 2 years ago

I had the same issue, ended up resolving it using a AwsCustomResource and an SDK call to start-job. My answer on Stack Overflow is here https://stackoverflow.com/a/72146964/6056963. There is also some more context in that answer.

swizzmagik commented 2 years ago

You solved by problem less than 1 hour later thank you.