Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async deployWebsockets() {
this.init()
await this.prepareFunctions()
if (
!is(Object, this.serverless.service.functions) ||
keys(this.serverless.service.functions).length === 0 ||
isEmpty(this.functions)
) {
return
}
this.serverless.cli.log(`Deploying Websockets API named "${this.apiName}"...`)
await this.createApi()
// We clear routes before deploying the new routes for idempotency
// since we lost the idempotency feature of CF
await this.clearRoutes()
await this.clearAuthorizers()
await this.clearIntegrations()
await this.createAuthorizers()
await this.createRoutes()
await this.createDeployment()
this.serverless.cli.log(
getWebsocketApiName() {
if (
this.serverless.service.provider.websocketApiName &&
is(String, this.serverless.service.provider.websocketApiName)
) {
return `${this.serverless.service.provider.websocketApiName}`
}
return `${this.serverless.service.service}-${this.provider.getStage()}-websockets-api`
}
getWebsocketApiRouteSelectionExpression() {
if (
this.serverless.service.provider.websocketApiRouteSelectionExpression &&
is(String, this.serverless.service.provider.websocketApiRouteSelectionExpression)
) {
return `${this.serverless.service.provider.websocketApiRouteSelectionExpression}`
}
return `$request.body.action`
}
async define() {
const policy = resolve(this.policy)
if (is(AwsIamPolicy.class, policy)) {
return {
policy
}
}
return {}
}
async define() {
const policy = resolve(this.policy)
if (is(AwsIamPolicy.class, policy)) {
return {
policy
}
}
return {}
}