Нужна помощь с этой ошибкой -
{
«errorMessage»: «RequestId: 18120028-124f-11e9-9e46-b3db6ae39b34 Процесс завершен до завершения запроса»
}
Также у меня в логах есть следующее
2019-01-07T07: 37: 32.797Z 18120028-124f-11e9-9e46-b3db6ae39b34 Неожиданный параметр: в параметрах обнаружен неожиданный ключ «BillingMode»
на ParamValidator.fail (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:50:37)
в ParamValidator.validateStructure (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:77:14)
в ParamValidator.validateMember (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:88:21)
в ParamValidator.validate (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:34:10)
at Request.VALIDATE_PARAMETERS (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:125:42)
в Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
в callNextListener (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
по адресу /var/runtime/node_modules/aws-sdk/lib/event_listeners.js:85:9
на финише (/var/runtime/node_modules/aws-sdk/lib/config.js:320:7)
по адресу /var/runtime/node_modules/aws-sdk/lib/config.js:338:9
Вот мой пакет. Json
{
"name": "xxxxxxx",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"aws-sdk": "^2.382.0",
"serverless-dynamodb-local": "^0.2.35",
"uuid": "^3.3.2"
},
"devDependencies": {
"bcrypt-nodejs": "0.0.3",
"dynamoose": "^1.3.0",
"factory-girl": "^5.0.4",
"faker": "^4.1.0",
"moment": "^2.23.0",
"serverless-aws-documentation": "^1.1.0",
"serverless-mocha-plugin": "^1.9.1",
"serverless-offline": "^3.31.3",
"serverless-plugin-include-dependencies": "^3.2.1",
"serverless-reqvalidator-plugin": "^1.0.3",
"serverless-webpack": "^5.2.0",
"webpack": "^4.27.1"
}
}
Вот действие -
'use strict';
const Insider = require('../models/insider').Insider;
const InsiderTest = require('../models/insider').InsiderTest;
module.exports.index = (_event, _context, callback) => {
const klass = (process.env.STAGE == 'test') ? InsiderTest : Insider
klass.scan().exec((_err, data) => {
if (data.count == 0) {
callback(null, {
statusCode: 422,
error: 'No Insiders'
});
return;
}
const response = {
data: {
results: data
},
statusCode: 200
}
callback(null, response);
});
};
serverless.yml
service: vs-aws-lambda-serverless-services
package:
exclude:
- node_modules/**
include:
- models/**
plugins:
- serverless-reqvalidator-plugin
- serverless-aws-documentation
- serverless-offline
- serverless-dynamodb-local
- serverless-mocha-plugin
- serverless-plugin-include-dependencies
#############################################
# Standard Serverless Definition
#############################################
provider:
name: aws
region: xxxxxxx
runtime: nodejs8.10
stage: xxxx
iamRoleStatements:
- Effect: Allow
Action:
- dynamoDB:DescribeTable
- dynamoDB:Query
- dynamoDB:Scan
- dynamoDB:GetItem
- dynamoDB:PutItem
- dynamoDB:UpdateItem
- dynamoDB:DeleteItem
Resource: "arn:aws:dynamodb:xxxxxxx:*:*"
#############################################
# #############################################
# # Model Definitions - API Gateway
# #############################################
custom:
documentation:
models:
-
name: CreateSuccessResponse
contentType: 'application/json'
schema:
type: object
properties:
message:
type: string
statusCode:
type: string
-
name: xxxxxxsRequest
contentType: 'application/json'
schema:
type: object
required:
- name
properties:
name:
type: string
profileImage:
type: string
gender:
type: string
fullDescription:
type: string
shortDescription:
type: string
interests:
type: array
personalities:
type: array
travelledCities:
type: array
tribes:
type: array
funFacts:
type: array
dynamodb:
start:
migrate: true
#############################################
#############################################
# Lambda Functions
#############################################
functions:
listInsiders:
handler: insiders/index.index
events:
- http:
path: insiders
method: get
cors: true
integration: lambda
response:
headers:
Access-Control-Allow-Origin: "'*'"
documentation:
methodResponses:
-
statusCode: '200'
responseModels:
"application/json": CreateSuccessResponse
#############################################
#############################################
# Resource Definitions
#############################################
resources:
Resources:
xxxxxxsDynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
-
AttributeName: uuid
AttributeType: S
KeySchema:
-
AttributeName: uuid
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: 'table_name'
requestBody:
Type: 'AWS::ApiGateway::RequestValidator'
Properties:
Name: 'requestBody'
RestApiId:
Ref: ApiGatewayRestApi
ValidateRequestBody: true
#############################################