Can't pass headers or status code as response to HTTP request

I’m returning something like this to my serverless function:

{
  statusCode: 302,
  headers: {
    'Location': 'https://test.com/',
    'Set-Cookie': setCookie
  },
  body: 'Redirecting...'
}

Also, I’m using this as my settings for the lambda function:

- http:
    path: 'auth/steam/verify'
    method: get
    integration: lambda
    request:
      template:
        application/json: 'bla'

When I send a request to the endpoint, it just sends the literal JSON instead of sending the 302 status code and the headers. I believe this is a problem with lambda integration, but I don’t understand how to solve it.

You are mixing lambda and lambda-proxy.

Short answer: remove “integration” and “request” from serverless.yml

1 Like

ah, so is there anyway to access the query params or headers with lambda proxy?

never mind. I see. the event has a body param and I can access query params from there