Raphael
Raphael

Reputation: 723

AWS - Serverless - "message": "Internal server error" when deploying, but work offline

I have a problem when deploying a project using Serverless framework and Amazon Web Services (more specifically API Gateway service).

On my local machine, when I do serverless offline everything works fine: When going to http://localhost:3000/, I have:

{
    "message": "welcome"
}

When navigating to http://localhost:3000/examples, I have:

{
    "message": "Example test"
}

However, when deploying with serverless deploy, only the first one works. The next one displays the following:

{
    "message": "Internal server error"
}

In my code I have the following routes:

app.use('/examples', ExampleController)

app.get('/', (request, response) => {
  response.json({
    message: 'welcome'
  })
})

And this is what I have in my ExampleController:

ExampleController.get('/', (request, response) => {
  response.json({
    message: 'Example test'
  })
})

What can be the problem here?

Upvotes: 1

Views: 2603

Answers (1)

Raphael
Raphael

Reputation: 723

Fixed my problem by adding the following role in iamRoleStatements in serverless.yml:

-  Effect: "Allow"
   Action:
     - "cloudformation:DescribeStackResource"
   Resource: "*"

Upvotes: 2

Related Questions