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.

(wafv2): change in CfnWebACL model validation & lack of associated documentation

See original GitHub issue

❓ General Issue

I don’t think this is a bug with CDK per se. I see differing CloudFormation behavior from just one day ago having to do with aws-wafv2.

cdk deploy previously resulted in completion of stack creation but now results in error message:

Model validation failed (#: extraneous key [true] is not permitted)

I identified that this is due to how the CfnWebAcl.props.defaultAction parameter were coded. Below is an example.

              defaultAction: {
                     block: {
                         true: true,
                     }
                },

It now must be

              defaultAction: {
                     block: {}
                },

Iterating to this point was not obvious. I tried different keys and values to no avail. Attempting block: true resulted in cdk exception:

block: true should be an 'object'.

Other similar patterns are problematic such as for CfnWebAcl.props.rules.action

In addition the language-specific api documentation for most (any?) is non existent. For example, https://docs.aws.amazon.com/cdk/api/latest/typescript/api/aws-wafv2/ruleactionproperty.html results in 404. This does not help with determining correct syntax.

The Question

I guess my question is what changed and where is the resource to figure out what the correct syntax is? I was even using the same ver cdk between behavior changes so I imagine this is a CloudFormation change in behavior.

Also, was I doing something incorrect originally? I remember having to try a couple different approaches to forming an object that worked - might have even seen an example of the idiom in the issue tracker.

Environment

  • CDK CLI Version: 1.74.0 (build e86602f)
  • Module Version: 1.74.0
  • Node.js Version: v10.22.1
  • OS: Ubuntu 20.04
  • Language (Version): TypeScript 3.7.5

Other information

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
arjanschaafcommented, Apr 14, 2021

Ran into this issue with a Java based CDK project as well. Fix was to use this code:

CfnWebACL.DefaultActionProperty.builder().allow(Collections.emptyMap()).build()
1reaction
Pokiscommented, Nov 26, 2020

Nah mate, tried that and similar approaches. Current solution that I am going to do is: Generate cloudformation with synth -> substitute the required part with simple string substitute -> deploy the generated file

Adjusted the place where I need to substitute with: webAcl.AddPropertyOverride(“DefaultAction.Allow”, “CHANGE_THIS_WITH_BRACKETS”); so all I have to do is substitute that keyword. If I add brackets there btw, it just parses them as string, and json must be there, so cant do that directly apparently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

class CfnWebACL (construct) · AWS CDK
The values are placeholders you should change. import * as wafv2 from '@aws-cdk/aws-wafv2'; declare const all: any; declare const allQueryArguments: any; ...
Read more >
awswafv2 - Go Packages
AWS::WAFv2 Construct Library. This module is part of the AWS Cloud Development Kit project. import wafv2 "github.com/aws/aws-cdk-go/awscdk".
Read more >
Different signatures for **wafv2.CfnWebACL** interface in aws ...
Because the documentation link in the question refers to aws-waf , and you're using aws-wafv2 , which is different. Here's the documentation ......
Read more >
Technical How-to | Noise | Page 4
Enter a description for the list (optional). Enter the S3 bucket name. Enter the S3 object name of the plaintext file. Note: 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