0

I have a NestJs application that is uses the serverless package to deploy my API onto aws lambdas and another NestJs application hosted on Railway that uses websockets.

I haven't not configured anything to make my lambda use CloudFront, and testing my lambdas through postman works fine, but the minute I use my websocket(socket.io) connection to my lambda throws an error.

const response = await request<Response<response>>(`${this.config.get<string>('API_URL')}/rooms`, {
      method: 'GET',
      headers: {
        "Content-Type": "application/json",
        Authorization: user.token,
      }
    });

this is the request I'm making(uses axios under the hood). when I make this request I get this cloudFront error

<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
</PRE>

I can make this same request using a postman request directly to the lambda though, and I have cors enabled on both applications and origins of both URLs set on both applications.

Thanks in advance

I've tried redeploying both applications, and creating a cloudfront distribution, but I don't know what that distribution does.

itsninjabunny
  • 21
  • 1
  • 4

0 Answers0