1

I'm trying to deploy my application with App Runner in AWS via CDK. It's based on https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apprunner.Service.html. When I deploy this, I get:

create_failed: Resource handler returned message: "null" (RequestToken: 6a2b87e7-afe6-4519-9ff6-977081c43d89, HandlerErrorCode: null).

Not much to go on, unfortunately. Does any of you see anything wrong in this typescript cdk?


const apiAppRunnerInstanceRole = new iam.Role(...);
const apiAppRunnerAccessRole = new iam.Role(...);

const apiRepo = ecr.Repository.fromRepositoryName(this, "my-api-ecr", "my-api-ecr");

const apiApprunnerService = new apprunner.Service(this,'my-api-service', {
  source: apprunner.Source.fromEcr({
    imageConfiguration: { 
      port: 80,
      environment: {
        "SomeKey" : "SomeValue",
      },},
    repository: apiRepo,
    tag: 'latest',
  }),
  serviceName: "my-api-service",
  accessRole: apiAppRunnerAccessRole,
  instanceRole: apiAppRunnerInstanceRole,
});

If I can't find anything, I'm just going to go back to cfnService (https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apprunner.CfnService.html) but maybe I'm just missing the obvious here.

Thanks in advance for any help you can offer!

Lindy Hutz
  • 45
  • 1
  • 5
  • Which resource? – gshpychka Nov 30 '21 at 13:05
  • It seems like a custom resource handler timed out or failed. Can you check your CloudWatch logs and see if there are any logs related to a lambda function or custom resource? – Ryan Nov 30 '21 at 23:11
  • 1
    Another thing that I would try is to deploy without configuring the `accessRole` and `instanceRole`. Let the `apprunner.Service()` create what it needs and see if it's successful. – Ryan Nov 30 '21 at 23:13
  • You can try and run CDK with more verbose information by adding `-vvv` as an argument on the command-line. In the past I've also had issues deploying to app runner and it turned out that my `imageIdentifier` was incorrectly formatted. – Jeroen Dec 06 '21 at 12:34
  • Thanks for your comments! Due to time restrictions, I went back to ECS for now. But I'll give your comments a go soon and reply with what worked. – Lindy Hutz Dec 07 '21 at 14:54

1 Answers1

0

I faced similar issue. Even though there isn't much stated in the CloudFormation stack. You can find more details from CloudWatch logs. Go to CloudWatch > Log group > find your app runner service log (or other related log under app runner log group). Expand the logs and check the logs.

In my case it was a stupid mistake of defining the wrong port in Dockerfile vs the one I exposed on the server..

unacorn
  • 827
  • 10
  • 27