Websocket application with Node.js, Serverless Framework and AWS Services
Video how to use
·
Report Bug
·
Request Feature
Template aplication websocket using nodejs, serverless framework and aws api gateway and aws DynamoDB
-
Create Access/Secret Keys on AWS
-
- IAM service
-
-
- Create new user type programmatic access
-
-
-
-
- Permissions: AdministratorAccess
-
-
-
Create provider for AWS with Access/Secret Keys
- Create Access Key on Serverless Framework Dashboard
- Create Secret Key for Serverless Framework on Github Repository
-
- SERVERLESS_ACCESS_KEY
-
Install Serverless Framework
-
$ npm install -g serverless
-
Changes informations on serverless.yml
-
-
- org, app, service are important
-
-
Connect project with dashboard of Serverless Framework
-
$ serverless login
-
Configure project with Serverless Framework
-
$ serverless
-
- Choose create project
-
- Choose deploy project
-
Verify project created
-
$ serverless info
-
- View Serverless Framework Dashboard
-
- View services created on AWS Services used
-
View your endpoints and services created
-
$ serverless info
-
Testing the Websocket
-
- Yo can use the Chrome Extension below
-
- Example of payloads for test this template application websocket
-
Make changes on code and redeploy
-
$ serverless deploy
-
Remove all project
-
$ serverless remove
-
If on step "Configure project with Serverless Framework" show up error below
Error: The provided access key is not authorized for this operation. - Please contact support and provide this identifier to reference this issue - 6XTBZKM5S92D
-
- Go to C:\Users\USERNAME\
-
-
- Delete file
.serverlessrc
- Delete file
-
-
-
- Run again:
$ serverless login
- Run again:
-
-
-
- Run again:
$ serverless
- Run again:
-
-
If on step "Configure project with Serverless Framework" show up error below
'/20210819/us-east-1/sts/aws4_request' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential=AKIASXQVJM56373DDF /20210819/us-east-1/sts/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=cd6bde074a6941be7623f8156a6a6775613f3bd848f855d78b556bef116f03e7'.
-
- Access Key or Secret Key is wrong on Serverless Framework Dashboard in Provider used
-
If on step "Configure project with Serverless Framework" show up error below
An error occurred: WebsocketsDeploymentStage - CloudWatch Logs role ARN must be set in account settings to enable logging (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException; Request ID: cde1d14f-6dbc-46d3-8568-1433e7f712ff; Proxy: null).
-
- Create new role
-
-
- Select type of trusted entity > AWS Service
-
-
-
- Choose a use case > API Gateway
-
-
-
- Click Next: Permissions
-
-
-
- Permissions: AmazonAPIGatewayPushToCloudWatchLogs
-
-
-
- Click Next: Tags and Click Next: Review
-
-
-
- Add name: serverlessAPIGatewayCloudWatchLogs and Click Create Role
-
-
-
- remove the comment the line 20 of serverless.yml
-
-
-
- replace
{AccountId}
for your account Id
- replace
-
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.