serverless / serverless/serverless

Feature Request: Usage plans for Websockets API

Open
#6,096 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

cat/aws-event-api-gateway enhancement
Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

This is a Feature Proposal

Description

AWS supports setting ApiKeyRequired to true for the $connect route. This is useful specifically when setting the apiKeySource value to "AUTHORIZER". Currently, there is no way to add these values from serverless.

My main goal is to connect the WebSockets API Gateway to the same usage plans created for the Rest API and set the ApiKeyRequired value on the $connect route which uses a custom authorizer that will provide the key because browsers don't support setting custom headers.

A possible implementation of setting the ApiKeyRequired value could look as follows.

events:
  - websocket:
      private: true
      routeKey: $connect

A possible implementation of connecting the usage plan could look as follows.

websocketsApiUsagePlans:
  - free
 usagePlan: 
   - free
     quota:
       limit: 5000
       offset: 2
       period: MONTH
     throttle:
       burstLimit: 200
       rateLimit: 100

Similar or dependent issues:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the websocket event configuration and the API Gateway usage-plan settings described in the proposal. Determine how the $connect route, ApiKeyRequired, apiKeySource, shared REST API usage plans, quotas, and throttles should be represented. Done means users can configure these values in serverless.yml and the generated AWS configuration connects the WebSockets API to the requested usage plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
api, backend, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.