serverless-event-gateway-plugin icon indicating copy to clipboard operation
serverless-event-gateway-plugin copied to clipboard

Error when deploying multiple functions with same CORS config

Open alexdebrie opened this issue 5 years ago • 0 comments

If I try to deploy two functions with cors: true, I get the following error:

Couldn't configure CORS for path /alexdebrie-auth/. Error: Failed to create CORS configuration due the error: CORS configuration "POST%2Falexdebrie-auth%2F" already exists.

I think the source is around here. Likely need some sort of create-or-update CORS ability.

serverless.yml to repro:

service: event-gateway-cors
app: my-app
tenant: my-tenant

plugins:
  - "@serverless/serverless-event-gateway-plugin"

custom:
  eventTypes:
    user.created:
    user.deleted:

provider:
  name: aws
  runtime: python3.6
  stage: dev
  region: us-east-1

functions:
  main:
    handler: handler.main
    events:
      - eventgateway:
          type: sync
          eventType: user.created
          path: /
          cors: true
  delete:
    handler: handler.main
    events:
      - eventgateway:
          type: async
          eventType: user.deleted
          path: /
          cors: true

alexdebrie avatar Jul 17 '18 14:07 alexdebrie