在将无服务器部署到AWS时,资源创建取消了错误。我认为这可能是日志组的访问问题,但不确定

时间:2018-11-27 01:47:06

标签: amazon-web-services amazon-s3 amazon-cloudformation serverless-framework aws-serverless

我是无服务器新手。实际上,几年后重新开始编写代码。在aws-node上的无服务器的helloworld中成功deplogy之后,我试图创建一个dynamoDB表。 我得到的错误如下。我尝试寻找解决方案,但现在已放弃。我已经粘贴了详细的错误,YAML文件,并且还附加了来自云形成控制台的事件。任何指针将不胜感激。

顺便说一句,我正在使用具有管理权限的程序用户。我还给出了有问题的serverless.yml文件

谢谢

无服务器错误---------------------------------------

发生错误:UserDashresponseDashpostLogGroup-资源创建已取消。

**编排控制台屏幕图像** cloudformation evernts screenshot

*下面的详细日志

--------------------

Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:deploy:deploy
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
.....
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (12.36 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.....
Serverless: Operation failed!

  Serverless Error ---------------------------------------

  An error occurred: UserDashresponseDashpostLogGroup - Resource creation cancelled.

  Stack Trace --------------------------------------------

ServerlessError: An error occurred: UserDashresponseDashpostLogGroup - Resource creation cancelled.
    at provider.request.then (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\monitorStack.js:112:33)
From previous event:
    at AwsDeploy.monitorStack (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\monitorStack.js:26:12)
    at provider.request.then (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\updateStack.js:95:30)
From previous event:
    at AwsDeploy.update (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\updateStack.js:95:8)
From previous event:
    at AwsDeploy.BbPromise.bind.then (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\updateStack.js:112:12)
From previous event:
    at AwsDeploy.updateStack (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\updateStack.js:106:8)
From previous event:
    at AwsDeploy.BbPromise.bind.then (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:129:39)
From previous event:
    at Object.aws:deploy:deploy:updateStack [as hook] (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:125:10)
    at BbPromise.reduce (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:55)
From previous event:
    at PluginManager.invoke (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:22)
    at PluginManager.spawn (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:408:17)
    at AwsDeploy.BbPromise.bind.then (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:95:48)
From previous event:
    at Object.deploy:deploy [as hook] (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:91:10)
    at BbPromise.reduce (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:55)
From previous event:
    at PluginManager.invoke (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:22)
    at PluginManager.run (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:421:17)
    at variables.populateService.then.then (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:157:33)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
    at process.topLevelDomainCallback (domain.js:121:23)
From previous event:
    at Serverless.run (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:144:8)
    at serverless.init.then (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\bin\serverless:43:50)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     win32
     Node Version:           10.13.0
     Serverless Version:     1.32.0

serverless.yml

    service: testDynamo # NOTE: update this with your service name

custom:
  accountId: ${opt:accountId, "xxxxxxxxxx   "}
  region: ${self:provider.region}
  config: ${opt:config, "default"}
  stage: ${self:provider.stage}
  tableThroughputs:
    prod: 5
    default: 1
  tableThroughput: ${self:custom.tableThroughputs.${self:custom.stage}, self:custom.tableThroughputs.default}
  highTableThroughput: ${opt:telemetryThroughput, self:custom.tableThroughputs.default}
  dynamoDeletionPolicy: ${opt:dynamoDeletionPolicy, "Retain"}
  webpack:
    webpackConfig: ./webpack.config.js
    includeModules: true
  #environment: ${file(env.yml):${self:custom.stage}, file(env.yml):default}
  dynamodb:
    start:
      port: 8000
      inMemory: true
      migrate: true
      migration:
        dir: offline/migrations
  serverless-offline:
    babelOptions:
      presets: ["env"]



provider:
  name: aws
  runtime: nodejs8.10
  stage: ${opt:stage, "dev"}
  region: ${opt:region, "ap-southeast-2"}
 # profile: "devProfileslsAdmin" #updated in ~/.aws/credentials in local directory
  environment: ${file(config/env.yml):${self:custom.config}}

  iamRoleStatements:
    - Effect: Allow
      Action:
        - dynamodb:Query
        - dynamodb:Scan
        - dynamodb:GetItem
        - dynamodb:PutItem
        - dynamodb:UpdateItem
        - dynamodb:DeleteItem
        - dynamodb:BatchWriteItem
      Resource:
        - "Fn::GetAtt": [ UserResponseTable, Arn ]


functions:

  user-response-post:
    handler: src/vote/userResponse.main
    environment:
      USER_RESPONSE_CREATED_TOPIC_ARN: arn:aws:sns:${self:provider.region}:${self:custom.accountId}:${self:provider.stage}-user-

response-created
    events: 
     - http:
        path: api/userResponse
        method: post
        cors: true
    iamRoleStatements:
      - Effect: "Allow"        
        Action:
          - sns:*
        Resource: "*"
      - Effect: "Allow"        
        Action:
          - dynamodb:PutItem
        Resource: 
          - "Fn::GetAtt": [ UserResponseTable, Arn ]
resources:
  Resources:
    UserResponseTable:
      Type: 'AWS::DynamoDB::Table'
      Properties:
        #TableName: ${self:provider.environment.USER_RESPONSE_TABLE}
        TableName: user-response
        AttributeDefinitions:
          - AttributeName: eventId
            AttributeType: S
          - AttributeName: questionId
            AttributeType: S
        KeySchema:
          - AttributeName: eventId
            KeyType: HASH
          - AttributeName: questionId
            KeyType: RANGE

0 个答案:

没有答案