I'm trying to use the Serverless framework to create a Lambda which is invoked when a client connects to a websocket API Gateway. AWS CloudFormation is creating the Lambda functions that are defined but the websocket API Gateway isn't being created.
After attempting to write my own (which didn't work) I resorted to copy and pasting the examples I've found on Serverless docs into a freshly created serverless folder just to see if it would work - it didn't, and I can't find anyone else who seems to have had a similar problem.
So far I've tried the simple and extended methods documented here (which is what the example code is based on): https://serverless.com/framework/docs/providers/aws/events/websocket/
And I've also tried to follow this blog, which also resulted in the Lambda creation but not an API Gateway. https://serverless.com/blog/api-gateway-websockets-example/
Here's my serverless.yml file. It deploys as I would expect, apart from the API Gateway:
service: temp
provider:
name: aws
runtime: nodejs8.10
region: eu-west-2
functions:
default:
handler: handler.connect
events:
- websocket:
route: $default
Here is the serverless deploy -v output:
$ serverless deploy -v
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - temp-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - temp-dev
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (386 B)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
CloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - temp-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - DefaultLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - DefaultLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - DefaultLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - DefaultLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - DefaultLambdaFunction
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Function - DefaultLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - DefaultLambdaVersionY0DDREbM8apFqgW7p0WqFe2SjYB4Wt7O63fYPiljU
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - DefaultLambdaVersionY0DDREbM8apFqgW7p0WqFe2SjYB4Wt7O63fYPiljU
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - DefaultLambdaVersionY0DDREbM8apFqgW7p0WqFe2SjYB4Wt7O63fYPiljU
CloudFormation - UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - temp-dev
CloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - temp-dev
Serverless: Stack update finished...
Service Information
service: temp
stage: dev
region: eu-west-2
stack: temp-dev
api keys:
None
endpoints:
None
functions:
default: temp-dev-default
layers:
None
Stack Outputs
DefaultLambdaFunctionQualifiedArn: arn:aws:lambda:eu-west-2:[redacted]:function:temp-dev-default:3
ServerlessDeploymentBucketName: temp-dev-serverlessdeploymentbucket-[redacted]
If anyone can shed some light on this as I may be completely missing something obvious, I'd be grateful.
serverless deploy --verbose
to see if you can get more hints ? What exactly is wrong with the deployment ? Nothing is created in API gateway ? - Hugoserverless deploy -v
to the question. Yes, nothing is created in API Gateway like you would expect. - James-Prescott