for dynamodb document client sdk var AWS = require('aws-sdk') Į.g. You need to add the following parameters to the AWS NODE SDK dynamodb constructorĮ.g. The value of the key doesn't really matter. Note: If you're using API_KEY as your authenticationType, then a x-api-key header has to be present in the request. You must also specify -dbPath when you use this parameter.Īll the above options can be added to serverless.yml to set default configuration: e.g. optimizeDbBeforeStartup -o Optimizes the underlying database tables before starting up DynamoDB on your computer. plugins: - serverless-dynamodb-local only if you need dynamodb resolvers and you dont have an external dynamodb - serverless-appsync-simulator - serverless-offline. This plugin relies on your serverless yml file and on the serverless-offline plugin. Then in serverless.yml add following entry to the plugins array: serverless-appsync-offline.
#Npm serverless appsync offline install
(Currently, this parameter introduces delays only for global secondary indexes that are in either CREATING or DELETING status.) npm install serverless-appsync-simulator or yarn add serverless-appsync-simulator Usage. npm install -save serverless-appsync-offline. Setting this parameter helps DynamoDB simulate the behavior of the Amazon DynamoDB web service more closely.
DynamoDB can perform some tasks almost instantaneously, such as create/update/delete operations on tables and indexes however, the actual DynamoDB service requires more time for these tasks. delayTransientStatuses -t Causes DynamoDB to introduce delays for certain operations. If you specify -sharedDb, all DynamoDB clients will interact with the same set of tables regardless of their region and credential configuration. sharedDb -h DynamoDB will use a single database file, instead of using separate files for each credential and region. For example to create /node_modules/serverless-appsync-offline/dynamob/ you should specify -d / or -dbPath / with a forwardslash at the end. Im unfamiliar with npm, only used it for basic serverless. For the path, current working directory is /node_modules/serverless-appsync-offline/dynamob. Note that you cannot specify both -dbPath and -inMemory at once. If you do not specify this option, the file will be written to the current directory. dbPath -b The directory where DynamoDB will write its database file. When you stop DynamoDB, none of the data will be saved. Lambda Function build by TypeScript/Webpack. inMemory -i DynamoDB will run in memory, instead of using a database file. A Serverless Framework template that allows you to launch an AppSync emulator locally and proceed with development. dynamoDbPort -d Port to access the dynamoDB.
Add Appsync Resource definitions to your Serverless configuration, as defined here: Īll CLI options are optional: -port -p Port to provide the graphgl api.serverless-appsync-offline Using the Plugin