Hello! I'm trying to recreate a serverless.yaml se...
# sst
h
Hello! I'm trying to recreate a serverless.yaml setup in SST for my WebSockets. In my Yaml file i have the following:
Copy code
functions:
  authorizer:
    handler: fn_authorizer.lambda_handler
    runtime: nodejs14.x
  connection-manager:
    handler: fn_connection_manager.lambda_handler
    events:
      - websocket:
          route: $connect
          authorizer:
            name: authorizer
            identitySource:
              - "route.request.querystring.Auth"
      - websocket:
          route: $disconnect
This applies the custom authorizer for the $connect route. It's an IAM response. I've noticed that SST does handle IAM authorizer for WebSockets but it doesn't look to handle a custom lambda function to handle the authentication. Is there maybe a CDK solution? Or an SST solution that I'm just missing? My current solution was to deploy the Websockets via SST and then use the above yaml to attach the authorizer and routes. But this solution relies on cloud watch and cloud watch is lacking proper logging for websockets in my experience. note: connection-manager has a python runtime (not that this should change anything but yeah). Thanks
f
Hey @Hubert, I can add support for lambda authorizer later today. Would that work for you?
h
That would be amazing!!! Thank you!
j
@Frank @Hubert PR awaiting comments and/or approval.
f
Thanks @JP (junaway), running it now. Going to update the doc and then merge it.