繁体   English   中英

AWS-无服务器-“消息”:部署时“内部服务器错误”,但脱机工作

[英]AWS - Serverless - “message”: “Internal server error” when deploying, but work offline

使用无服务器框架和Amazon Web Services(更具体地说是API Gateway服务)部署项目时遇到问题。

在本地计算机上,当我执行serverless offline一切正常:在http://localhost:3000/ ,我有:

{
    "message": "welcome"
}

导航到http://localhost:3000/examples ,我有:

{
    "message": "Example test"
}

但是,使用serverless deploy ,只有第一个起作用。 下一个显示以下内容:

{
    "message": "Internal server error"
}

在我的代码中,我有以下路线:

app.use('/examples', ExampleController)

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

这就是我的ExampleController中的内容:

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

这可能是什么问题?

通过在serverless.yml的iamRoleStatements中添加以下角色来解决我的问题:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM