serverless/serverless

deploy http triggers to api gateway fails to consider case-sensitive differences in paths

Open

#11,956 创建于 2023年5月10日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)JavaScript (46,915 star) (5,734 fork)batch import
bug/designcat/aws-event-api-gatewaygood first issuehelp wanted

描述

Are you certain it's a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest v3 release?

  • Yes, I'm using the latest v3 release

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Issue description

Deploying a api gateway http event triggered lambda function fails to deploy all paths if they only differ in path string casing.

i would expect

legacyDeviceService:
  handler: src/path
  events:
    - http:
      method: GET
      path: Services/DevicePaymentService.svc/{action}
      cors: true
    - http:
      method: GET
      path: services/devicepaymentservice.svc/{action}
      cors: true

to deploy two separate resources in my gateway, on the paths DevicePaymentService.svc and devicepaymentservice.svc respectively. But I only ever get the one service. image

apigateway paths are case sensitive so this feels like a bug?

Service configuration (serverless.yml) content

service: serverless-test

package:
  individually: true

provider:
  name: aws
  stage: ${env:ENVIRONMENT, 'test'}
  runtime: nodejs14.x
  logRetentionInDays: 30
  region: eu-west-1
  versionFunctions: false
  profile: rv-serverless

functions:
  legacyDeviceService:
    handler: src/legacy/devicePaymentService.legacyDeviceServiceHandler
    memorySize: 128
    timeout: 20
    events:
      - http:
          method: GET
          path: Services/DevicePaymentService.svc/{action}
          cors: true
      - http:
          method: GET
          path: services/devicepaymentservice.svc/{action}
          cors: true

Command name and used flags

serverless deploy --config .\serverless-test.yml --verbose

Command output

Running "serverless" from node_modules

Deploying serverless-test to stage test (eu-west-1)

Packaging
Excluding development dependencies for function "legacyDeviceService"
Retrieving CloudFormation stack
Uploading
Uploading CloudFormation file to S3
Uploading State file to S3
Uploading service legacyDeviceService.zip file to S3 (286 B)
Updating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Executing created change set
  UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - serverless-test-test
  CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
  CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi
  CREATE_IN_PROGRESS - AWS::Logs::LogGroup - LegacyDeviceServiceLogGroup
  CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
  CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
  CREATE_IN_PROGRESS - AWS::Logs::LogGroup - LegacyDeviceServiceLogGroup
  CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
  CREATE_COMPLETE - AWS::Logs::LogGroup - LegacyDeviceServiceLogGroup
  CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi
  CREATE_COMPLETE - AWS::ApiGateway::RestApi - ApiGatewayRestApi
  CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceServices
  CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceServices
  CREATE_COMPLETE - AWS::ApiGateway::Resource - ApiGatewayResourceServices
  CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceServicesDevicepaymentservicesvc
  CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceServicesDevicepaymentservicesvc
  CREATE_COMPLETE - AWS::ApiGateway::Resource - ApiGatewayResourceServicesDevicepaymentservicesvc
  CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceServicesDevicepaymentservicesvcActionVar
  CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceServicesDevicepaymentservicesvcActionVar
  CREATE_COMPLETE - AWS::ApiGateway::Resource - ApiGatewayResourceServicesDevicepaymentservicesvcActionVar
  CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodServicesDevicepaymentservicesvcActionVarOptions
  CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodServicesDevicepaymentservicesvcActionVarOptions
  CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodServicesDevicepaymentservicesvcActionVarOptions
  CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution
  CREATE_IN_PROGRESS - AWS::Lambda::Function - LegacyDeviceServiceLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Function - LegacyDeviceServiceLambdaFunction
  CREATE_COMPLETE - AWS::Lambda::Function - LegacyDeviceServiceLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Permission - LegacyDeviceServiceLambdaPermissionApiGateway
  CREATE_IN_PROGRESS - AWS::Lambda::Permission - LegacyDeviceServiceLambdaPermissionApiGateway
  CREATE_COMPLETE - AWS::Lambda::Permission - LegacyDeviceServiceLambdaPermissionApiGateway
  CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodServicesDevicepaymentservicesvcActionVarGet
  CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodServicesDevicepaymentservicesvcActionVarGet
  CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodServicesDevicepaymentservicesvcActionVarGet
  CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1683721369453
  CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1683721369453
  CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1683721369453
  UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - serverless-test-test
  UPDATE_COMPLETE - AWS::CloudFormation::Stack - serverless-test-test
Retrieving CloudFormation stack
Removing old service artifacts from S3

✔ Service deployed to stack serverless-test-test (64s)

endpoints:
  GET - https://2yi3trt3df.execute-api.eu-west-1.amazonaws.com/test/Services/DevicePaymentService.svc/{action}
  GET - https://2yi3trt3df.execute-api.eu-west-1.amazonaws.com/test/services/devicepaymentservice.svc/{action}
functions:
  legacyDeviceService: serverless-test-test-legacyDeviceService (286 B)

Stack Outputs:
  ServiceEndpoint: https://2yi3trt3df.execute-api.eu-west-1.amazonaws.com/test
  ServerlessDeploymentBucketName: serverless-test-test-serverlessdeploymentbucket-ud2d77fg8tva

Need a faster logging experience than CloudWatch? Try our Dev Mode in Console: run "serverless dev"

Environment information

Running "serverless" from node_modules
Framework Core: 3.28.1 (local) 3.22.0 (global)
Plugin: 6.2.3
SDK: 4.3.2

贡献者指南