- Mais recentes
- Mais votos
- Mais comentários
This looks like a WS client issue. I tried with websockets (python), websocket-client (python) and wscat.
Working client : websocket and asyncio (python)
async def hello():
uri = "wss://<api>.execute-api.us-west-2.amazonaws.com/<stage>/"
async with websockets.connect(uri, ssl=ssl._create_unverified_context()) as websocket:
name = "<some large msg>"
await websocket.send(name)
print(f"> large")
greeting = await websocket.recv()
print(f"< {greeting}")
Exception : websockets.exceptions.ConnectionClosedError: code = 1009 (message too big), reason = Message too big
Clients eating away the err code :
websocket-client (python)
def withWebSock():
ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE})
ws = create_connection('wss://<api>.execute-api.us-west-2.amazonaws.com/<stage>',
sslopt={"cert_reqs": ssl.CERT_NONE})
ws.send("<some large msg>")
print(ws.recv())
Exception : websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed. No err code as such
wscat :
wscat -c wss://<api>.execute-api.us-west-2.amazonaws.com/<stage>/ -w 5 -x <some large msg>
Silently exits
API Gateway responds back with error code 1009 when it receives a larger frame or message as mentioned here - https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html.
I don't understand what you mean by "the response doesn't go through"? Do you mean the request doesn't go through to your lambda integration? What logs do you see for your API when you send a large message?
That may be what the documentation says, but from what we've seen in our use, that is not the case and it doesn't reply at all (as mentioned in the original post)
Agreed on the size limit. The websocket limit is 128k while the gateway HTTP limit is 10MB? I can imagine developers walking away from websockets over this limit alone.
My websocket will require my clients to implement multi-page request logic, as a very small percentage of requests will go over 128k.
If AWS increased the WebSocket frame size for just the initial frame it would make a huge difference.
That way the 1st frame could contain a large request from the client, with the response(s) going back as the request was processed.
The frame limit size of 32KB is unreasonably low and makes writing ANYTHING except a simple text chat application nearly impossible. I don't understand how this is justifiable given that AWS lambda has a payload size of 256KB, eight TIMES the size.
We are seriously considering dropping API gateway completely if this isn't resolved soon.
Conteúdo relevante
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há 2 anos