Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create send permissions for websockets on APIGateway #5955

Open
alpeshgaglani opened this issue Mar 25, 2019 · 1 comment
Open

Cannot create send permissions for websockets on APIGateway #5955

alpeshgaglani opened this issue Mar 25, 2019 · 1 comment

Comments

@alpeshgaglani
Copy link

I'm trying to create permissions for sending a message on websocket API gateway. My policy looks like

                PolicyDocument:
                  Version: '2012-10-17'
                  Statement:
                    - Effect: Allow
                      Action:
                        - 'execute-api:ManageConnections'
                      Resource: #!Sub 'arn:aws:execute-api:${self:provider.region}:${AWS::AccountId}:${self:custom.RestapiId}/*'
                        - 'Fn::Join':
                            - ':'
                            -
                              - 'arn:aws:execute-api'
                              - Ref: 'AWS::Region'
                              - Ref: 'AWS::AccountId'
                              - 'Fn::Join':
                                - '/'
                                -
                                  - Ref: ApiGatewayRestApi
                                  - '*'

My provider is set as:

provider:
  name: aws
  runtime: nodejs8.10
  stage: ${opt:stage,'dev'}
  region: us-west-2
  websocketsApiName: sync-${self:provider.stage}
  websocketsApiRouteSelectionExpression: $request.body.action

I was assuming that I can get the Ref for websocket api like we do for Rest api.
I tried to get Ref for ApiGatewayWebsocket(s)Api, but that doesnt work either.
What is the logical name for the websocket api?

@andrhamm
Copy link

- Ref: ApiGatewayRestApi should be - Ref: WebsocketsApi

You can find the resource names generated by the framework by inspecting your .serverless/cloudformation-template-update-stack.json file that is generated during the deploy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants