Request Validator name must be unique
Author: zoellnerCreated Oct 14, 2021Updated Aug 20, 2026
Labelsneeds feedbackcat/aws-event-api-gateway
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 version?
- Yes, I'm using the latest version
Is there an existing issue for this?
- I have searched existing issues, it hasn't been reported yet
Issue description
I started to see this error in our production build when updating from v2.47.0 to v2.61.0 (since also tried v2.62.0)
Serverless Error ----------------------------------------
An error occurred: ApiGatewayBcbserverapiRequestValidator - Resource handler returned message: "Request Validator name must be unique (Service: ApiGateway, Status Code: 400, Request ID: 30e29e25-296a-42c0-8e6d-cc8a6f31b826, Extended Request ID: null)" (RequestToken: f3479759-3512-b778-ed37-ea6faf4034d5, HandlerErrorCode: AlreadyExists).
Somehow it tries to create a RequestValidator that already exists. I can get the deploy to work when I rename the validator just before I deploy using aws apigateway update-request-validator --rest-api-id {apiID} --request-validator-id {validatorId} --patch-operations op=replace,path=/name,value=some-other-name
Is there a way to turn off the request validators? I don't really need those and have no idea why they're turned on here but not on some of my other APIs
Service configuration (serverless.yml) content
service: bcb-server-api
frameworkVersion: "=2.62.0"
projectDir: ../../
plugins:
- serverless-iam-roles-per-function
- serverless-domain-manager
- serverless-prune-plugin
- serverless-associate-waf
- serverless-offline
provider:
name: aws
runtime: nodejs14.x
region: us-east-1
stage: ${self:custom.stage}
deploymentBucket:
name: ${self:custom.config.deploymentBucket}
serverSideEncryption: AES256
environment: ${file(./environment.yaml)}
apiGateway:
apiKeySourceType: AUTHORIZER
minimumCompressionSize: 1024
endpointType: REGIONAL
logRetentionInDays: 90
tracing:
apiGateway: true
lambda: true
tags:
WAFCustomHeader: true
vpc:
securityGroupIds:
- ${self:custom.config.noIngressSecurityGroup}
subnetIds: ${self:custom.config.privateSubnetIds}
iam:
role:
statements:
- Effect: Allow
Action:
- xray:PutTraceSegments
- xray:PutTelemetryRecords
Resource: "*"
custom:
stage: ${opt:stage, 'local'}
serverless-offline:
httpPort: 8100
lambdaPort: 18100
noPrependStageInUrl: true
prune:
automatic: true
number: 5
serverless-iam-roles-per-function:
defaultInherit: true
associateWaf:
version: V2
name: ${self:custom.config.WAFname}
# stage dependent variables
config: ${file(./env-${self:custom.stage}.yml)}
customDomain:
enabled: ${self:custom.config.domainManagerEnabled}
domainName: api.${self:custom.config.baseDomain}
basePath: api
createRoute53Record: true
endpointType: regional
securityPolicy: tls_1_2
functions:
ProxyFunction:
handler: index.handler
memorySize: 1792
timeout: 10
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
Resource:
- ${self:provider.environment.DYNAMODB_TABLE_MAIN_ARN}
events: ${file(./serverless-bcb-api-events.json)}
onError: arn:aws:sns:${self:provider.region}:${self:custom.config.accountId}:pager-topic
AuthFunction:
handler: ./auth.handler
memorySize: 512
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
Resource:
- ${self:provider.environment.DYNAMODB_TABLE_MAIN_ARN}
resources:
Outputs:
ApiId:
Description: ID of the API
Value: !Ref ApiGatewayRestApi
Export:
Name: api-id
Command name and used flags
sls deploy --verbose
Command output
NA
Environment information
Operating System: linux
Node Version: 14.17.2
Framework Version: 2.62.0 (local)
Plugin Version: 5.4.7
SDK Version: 4.3.0
Components Version: 3.17.1
Source: serverless/serverless