aws / aws/chalice

accessing uri params for websockets api (question)

Open
#1,471 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

How to access uri query string parameters for websockets API with chalice?

E.g. my gateway uri has extra paramet(s) like
wss://my-example-gateway.com/api/?**id=some-id**&**param=value**

In nodejs I'd access the id and param values using event.queryStringParameters like in the code below:
exports.handler = async (event) => {
id = event.queryStringParameters.id,
param = event.queryStringParameters.param,
// ... do other stuff
};

but in chalice on_ws_connect event argument (type WebsocketEvent) I only see
```
self.domain_name = request_context['domainName']
self.stage = request_context['stage']
self.connection_id = request_context['connectionId']
self.body = event_dict.get('body')
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the WebsocketEvent construction used by on_ws_connect and inspect the event dictionary fields currently exposed, including body and request_context. Compare this with the API Gateway event shape described in the question and determine what behavior is needed for query-string access. Done means the supported access pattern is clear and covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
api, backend, cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.