【发布时间】:2019-10-24 13:31:09
【问题描述】:
我收到如下无服务器错误: 发生错误:CandidateSubmissionLambdaFunction - 属性变量的值必须是具有字符串(或简单类型)属性的对象。
我尝试将值从 yml 文件更改为字符串,然后我也遇到了同样的错误。
我的 Yml 文件代码如下:
frameworkVersion: ">=1.1.0 <2.0.0"
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: us-east-1
environment:
CANDIDATE_TABLE: ${self:service}-${opt:stage, self:provider.stage}
CANDIDATE_EMAIL_TABLE: "candidate-email-${opt:stage, self:provider.stage}"
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
Resource: "*"
resources:
Resources:
CandidatesDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: "id"
AttributeType: "S"
KeySchema:
-
AttributeName: "id"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification:
StreamViewType: "NEW_AND_OLD_IMAGES"
TableName: ${self:provider.environment.CANDIDATE_TABLE}
functions:
candidateSubmission:
handler: api/candidate.submit
memorySize: 128
description: Submit candidate information and starts interview process.
events:
- http:
path: candidates
method: post
环境信息
OS: linux
Node Version: 8.10.0
Serverless Version: 1.27.3
我想在 aws 上部署它并想执行 curd 操作。
【问题讨论】:
标签: node.js amazon-web-services aws-lambda serverless-framework