Hello everyone,
i’m trying to use serverless to publish my aws service. I’ve 3 different lambdas, a sqs queue and 2 api gateway (one for api server and another one for a websocket implementation). I’m trying to get the url reference for my api gateways. I’ve read some of the question already answered here and a blog post (How to I get my API Gateway URL with the Serverless Framework). Don’t know if is me but nothing seams to work.
This is a piece of my file:
service: test-serverless
custom:
region: region
stage: test
provider:
name: aws
runtime: nodejs8.10
profile: default
region: ${self:custom.region}
stage: ${self:custom.stage}
memorySize: 1024
timeout: 30
websocketsApiName: websocket-name-test-serverless
websocketsApiRouteSelectionExpression: $request.body.message
package:
individually: true
resources: # CloudFormation template syntax
Resources:
sqsQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "sqs-test"
functions:
WebSocketApi:
handler: handler.js
environment:
API_CLIENT_STAGE: ${self:custom.stage}
API_CLIENT_URL: env.GW_URL
TABLE_NAME: tablename
SQS_URL: https://sqs.eu-west-1.amazonaws.com/#{AWS::AccountId}/sqs-test
WS_ENDPOINT: ws_endpoint
package:
include:
- handler.js
events:
- websocket: $connect
- websocket: $disconnect
- websocket: $default
sqs:
handler: handler.js
environment:
API_CLIENT_URL: TODO_PUT_URL_HERE
API_WS_URL: TODO_PUT_URL_HERE
package:
include:
- handler.js
events:
- sqs:
arn:
Fn::GetAtt:
- sqsQueue
- Arn
ApiGatewayRestApi:
handler: handler.js
enviroment:
API_CLIENT_URL: TODO_PUT_URL_HERE
API_WS_URL: TODO_PUT_URL_HERE
package:
include:
- handler.js
events:
#LOGIN
- http:
method: post
path: /auth/token
integration: lambda
methodResponses:
-
StatusCode: 200
ResponseModels: {}
-
StatusCode: 401
ResponseModels: {}
-
StatusCode: 403
ResponseModels: {}
thanks