serverless / serverless

⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.
https://serverless.com
MIT License
46.39k stars 5.7k forks source link

Cannot set multiple key-value for an alb event conditions "header" #11884

Closed Inqnuam closed 1 year ago

Inqnuam commented 1 year ago

Are you certain it's a bug?

Is the issue caused by a plugin?

Are you using the latest v3 release?

Is there an existing issue for this?

Issue description

AWS Application Load Balancer listener rule allows to set multiple http-header key-value.

Screenshot 2023-04-02 at 14 48 43

Currently this isn't possible with Serverless Framework as "header" is an object which accepts only a "name" and "values"

Service configuration (serverless.yml) content

service: sls-project

frameworkVersion: "3"

package:
  individually: true

provider:
  name: aws
  runtime: nodejs18.x
  versionFunctions: false
  region: eu-west-3
  vpc:
    subnetIds: [subnet-0e2db7f9558f501d7, subnet-0cde9f3600cab039a]
    securityGroupIds: [sg-029d2fbba38db2dc7]

functions:
  lambda:
    handler: src/handlers/lambda.default
    events:
      - alb:
          listenerArn: arn:aws:elasticloadbalancing:xxxx
          priority: 936
          conditions:
            path: "/users"
            method: [GET]
            header:
              name: Content-Type
              values:
                - application/json

Command name and used flags

N/A

Command output

N/A

Environment information

Framework Core: 3.29.0 (local)
Plugin: 6.2.3
SDK: 4.3.2
medikoo commented 1 year ago

@Inqnuam thanks for reporting. That's surprising only support for single header was configured.

PR that enhances this is welcome!