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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠