copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

AppRunner: Resource handler returned message: "null"

Open OsirisO opened this issue 4 years ago • 5 comments

Hi 👋 ,

I am trying to a deploy a very basic hello world ExpressJS application as a Request-Driven Web Service (AppRunner). The Copilot environment is created successfully but then the service deployment fails with this error:

✔ Proposing infrastructure changes for stack hello-world
- Creating the infrastructure for stack hello-test-hello-world                   [rollback complete]  [700.9s]
  The following resource(s) failed to create: [Service]. Rollback requested by user.
  - An IAM Role for App Runner to use on your behalf to pull your image from ECR     [delete complete]    [0.0s]
  - An IAM role to control permissions for the containers in your service            [delete complete]    [0.0s]
  - An App Runner service to run and manage your containers                          [delete complete]    [0.0s]
    Resource handler returned message: "null" (RequestToken: 8faf28c8-0e5c-3a16-9af2-0c7995a5f51b, HandlerErrorCode: null)

The CloudFormation template is left in the ROLLBACK_COMPLETE state.

My Dockerfile looks like this:

FROM node:14
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 4001
CMD [ "node", "src/app.js" ]

I tested running my docker container locally and it works fine. The error message I get is not helpful. I don't know what is happening. Any help will be appreciated. Thank you!

OsirisO avatar Oct 17 '21 22:10 OsirisO

I was able to find more details on the actual error by going to AppRunner/CloudWatch while Copilot is running and see the actual errors causing AppRunner to fail.

dottyz avatar Oct 18 '21 16:10 dottyz

Hey @OsirisO. Sorry for the inconvenience that right now we don't have very helpful error messages if it fails to create the app runner service. @dottyz is correct and right and it would be one possible workaround for you to see why the app runner service creation failed.

However, for long term solution, we are planning to enhance the error log we display on terminal as well as supporting a --no-rollback flag for svc deploy (see here), preventing the service to be removed completely before you can see the logs.

iamhopaul123 avatar Oct 18 '21 16:10 iamhopaul123

Hey! I just ran into this. It's super frustrating to not get any error message returned back.

If anyone else runs into the same problem, I was able to see the logs for app runner deployment after the service was deleted by looking in Cloudwatch > Log groups. This way you don't have to try and catch the app runner service while it still exists.

Corollary to this is that the logs are never cleaned up. Perhaps I'm missing a setting somewhere to set logs to auto-expire. :)

ssisk avatar Dec 06 '21 21:12 ssisk

Got this message from a failed health check, a bit confusing. Would be great to have a verbose CF mode

SoundsSerious avatar Jun 22 '22 06:06 SoundsSerious

Hi @SoundsSerious I wonder if this problem can be solved by a verbose CF mode because even if I go to the CFN console, usually the only error msg I can see from there is Resource handler returned message: "null". Like @ssisk said those helpful logs are located in the CloudWatch log group for the failed-to-create service. Did you see anything helpful from CFN?

iamhopaul123 avatar Jun 22 '22 17:06 iamhopaul123