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.

dynamodb: Nested stack cannot depend on a parent stack when replicationRegions specified

See original GitHub issue

Nested stack synth fails with error when replicationRegions is set on DynamoDB Table.

Reproduction Steps

import { Construct, Stack, StackProps } from '@aws-cdk/core';
import { NestedStack } from '@aws-cdk/aws-cloudformation';
import { Table, AttributeType } from '@aws-cdk/aws-dynamodb';

export class DynamoNestedStack extends NestedStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    new Table(this, 'MyTable', {
      partitionKey: { name: 'pk', type: AttributeType.STRING },
      replicationRegions: ['us-east-2', 'us-west-1'],
    });
  }
}

export class CdkNested6726Stack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    new DynamoNestedStack(this, 'DynamoStack');
  }
}

Error Log

Here’s the error during synth.

     throw new Error(`Nested stack '${sourceStack.node.path}' cannot depend on a parent stack '${targetStack.node.path}'`);
           ^
Error: Nested stack 'CdkNested6726Stack/DynamoStack' cannot depend on a parent stack 'CdkNested6726Stack'

Environment

  • CLI Version : 1.24.0
  • Framework Version: 1.24.0
  • OS : macOS
  • Language :TypeScript

Other

I have tried this on CDK version 1.24.0, 1.25.0, 1.26.0, 1.27.0, and 1.28.0.


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
jogoldcommented, Mar 19, 2020

@cmckni3 replicationRegions is implemented using a custom resource in a nested stack.

1reaction
NetaNircommented, Mar 17, 2020

Thanks @cmckni3 for opening this issue and being a NetsedStacks hero. We are on it! Duplicate issue https://github.com/aws/aws-cdk/issues/6473

Read more comments on GitHub >

github_iconTop Results From Across the Web

class NestedStack (construct) · AWS CDK
Implements IConstruct , IConstruct , IDependable , ITaggable. A CloudFormation nested stack. When you apply template changes to update a top-level stack, ...
Read more >
AWS CDK and Amazon DynamoDB global tables
Here I've defined a table with three replication regions. If you deploy this code snippet in the AWS DynamoDB web console, you will...
Read more >
awsdynamodb - Go Packages
This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant...
Read more >
@aws-cdk/aws-dynamodb | Yarn - Package Manager
Amazon DynamoDB Construct Library. cfn-resources: Stable. cdk-constructs: Stable. Here is a minimal deployable DynamoDB table definition:
Read more >
AWS CDK accessing a resource in a parent stack from a ...
I am trying to pass an Arn for a resource created in a parent stack to be used in a nested stack. 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