Package Exports
- serverless-appsync-simulator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-appsync-simulator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
This serverless plugin is a wrapper for amplify-appsync-simulator made for testing AppSync APIs built with serverless-appsync-plugin.
Requires
- serverless framework
- serverless-appsync-plugin
- serverless-offline
- serverless-dynamodb-local (when using dynamodb resolvers only)
Usage
This plugin relies on your serverless yml file and on the serverless-offline
plugin*.
To start it, run the followin command:
sls offline start
You should see in the logs something like:
...
Serverless: AppSync endpoint: http://localhost:20002/graphql
Serverless: GraphiQl: http://localhost:20002
...
(*): If you are using DynamoDb resolvers, you'll also need serverless-dynamodb-local
Configuration
Put options under custom.appsync-simulator
in your serverless.yml
file
option | default | description |
---|---|---|
apiKey | 0123456789 |
When using API_KEY as authentication type, the key to authenticate to the endpoint. |
port | 20002 | AppSync operations port |
wsPort | 20003 | AppSync subscriptions port |
location | . (base directory) | Location of the lambda functions handlers. |
Example:
custom:
appsync-simulator:
location: '.webpack/service' # use webpack build directory
Caveats
This plugin currently only supports resolvers implemented by amplify-appsync-simulator
.
At the time of writing, this is:
- NONE
- AWS_LAMBDA (*)
- AMAZON_DYNAMODB
(*) Note: This plugin also supports AWS_LAMBDA
's BatchInvoke
(which Amplify Simulator doesn't)