Cannot connect to websocket when running 'chalice local'
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
When running a chalice application locally via 'chalice local' command, websockets connections are not functional. There is no references I could find in the documentation that state that websockets are not supported locally. When attempting to connect, the logs report back a 403 error message and no websocket handlers are executed.
Running the exact same project deployed works as expected, but our development team has a requirement that the application must be able to connect for local development purposes as well.
Steps to reproduce:
1. Setup a example application using websockets as per the documentation here: https://aws.github.io/chalice/tutorials/websockets#chat-server-example
2. Run the application via the command "chalice local". Notice that the app runs without any warnings at this point.
3. Using a tool such as "wscat", attempt to connect to the local websocket url.
`wscat -c "ws://127.0.0.1:8000/"`
This results in a 403 error being returned. Whereas when I deploy it to AWS and run the command using wss, it passes:
`wscat -c "wss://.execute-api.us-east-1.amazonaws.com/api/"`
Contributor guide
Research direction
Start with the `chalice local` entry point and the WebSocket chat-server example in the linked documentation. Reproduce the 403 response with `wscat` against the local URL, then compare it with the deployed `wss` behavior. Done means local WebSocket connections work with their handlers, or the limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- api, backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100