question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot call request validator options multiple times.

See original GitHub issue

Calling the constructor for RequestValidatorOptions multiple times gives an error

There is already a Construct with name ‘validator’ in RestApi

Reproduction Steps

`

    resource1.add_method(
        http_method='POST',
        integration=xxxIntegration,
        request_parameters={
            'method.request.header.passcode': True,
            'method.request.header.message': True
        },
        request_validator_options=_apigw.RequestValidatorOptions(validate_request_parameters=True, request_validator_name='POST-r1-validator')
    )

    resource2.add_method(
        http_method='POST',
        integration=yyyIntegration,
        request_parameters={
            'method.request.header.passcode': True,
            'method.request.querystring.id': True
        },
        request_validator_options=_apigw.RequestValidatorOptions(validate_request_parameters=True,request_validator_name='POST-r2-validator') 
    )

`

Error Log

Environment

  • **CLI Version :1.35.1
  • **Framework Version:1.35.1
  • **OS : Mac Mojave
  • **Language : Python

Other


This is 🐛 Bug Report

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:22
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
nija-atcommented, May 13, 2020

Thanks for filing this @durja. This is, in fact, a bug on the CDK.

You can workaround this by using the requestValidator property.

0reactions
github-actions[bot]commented, Nov 20, 2022

This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Validation in AWS CDK - Stack Overflow
While trying your solution, I think I stumbled on it. I was using a variable string in the construct ID and that caused...
Read more >
class RequestValidator (construct) · AWS CDK
Indicates whether to validate request parameters. restApi. Type: IRestApi. The rest API that this model is part of. The reason we ...
Read more >
Validation - Laravel - The PHP Framework For Web Artisans
However, many applications receive XHR requests from a JavaScript powered frontend. When using the validate method during an XHR request, Laravel will not ......
Read more >
Validation - Laravel Livewire
Customize Error Message & Attributes ; 2 · 3 ; 7 $validatedData = $this->validate(. 8 ; 10 'email.required' => 'The :attribute cannot be...
Read more >
Custom Validators — FluentValidation documentation
At the moment, our custom validator always returns the message “The list contains too many items” if validation fails. Instead, let's change the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found