Lindy Hutz
Lindy Hutz

Reputation: 65

AWS cdk error when trying to create App Runner

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!

Upvotes: 2

Views: 1199

Answers (1)

unacorn
unacorn

Reputation: 1042

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..

Upvotes: 2

Related Questions