WebSocket handshake: Unexpected response code: 403

0

Hi there!

I am having problems connecting to a websockets API created with Terraform.

In order to create it I did the following:

  1. I used Serverless to create a websockets API. Serverless example Websockets API works perfectly.
  2. Then I took the generated Cloudformation and I used the aws_cloudformation_stack resource in Terraform to create the API.

Lambda functions are created using Terraform and instead of including the whole cloudformation template copied and adapted from Serverless, I have removed the Cloudformation lambda related resources and I used the ARN generated by Terraform, passed via parameters.

The thing is, side by side, both APIs look exactly the same. Navigating the AWS UI all routes are created fine and the lambda functions are integrated correctly (apparently)

I can also execute the lambda functions independently and the console.logs are correctly written in the cloudwatch.

The problem is that when I try to connect to the Serverless API it works perfectly, but the Terraform API I receive a WebSocket handshake: Unexpected response code: 403

Any suggestions?

質問済み 3年前1686ビュー
1回答
0

Ok, I found out terraform / cloudformation template was not creating any deployment stage and therefore $routes were not connecting with the lambdas.

Notice that if you had a previous stage with the same name, you won't see the error.

I still didn't found how to create them using terraform. cloudformation, but if I create it manually the error disappears.

Thanks!

Edited by: XaviColomer on Nov 10, 2020 3:22 AM

回答済み 3年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ