- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.3k
Closed
Closed
Copy link
Labels
@aws-cdk/aws-appmeshRelated to AWS App MeshRelated to AWS App MeshbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp1
Milestone
Description
Adding a VirtualNode to a Mesh (where the Mesh is in one stack and the VirtualNode is in another) creates an circular reference, but shouldn't.
Reproduction Steps
Sample code available at buzzsurfr/appmesh-cross-stack-bug
Sample code in master branch works, but uncommenting the following lines...
...then run:
npm run build
cdk lsWhat did you expect to happen?
This shouldn't be a circular reference and should work.
What actually happened?
/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/stack.ts:688
      throw new Error(`'${target.node.path}' depends on '${this.node.path}' (${cycle.join(', ')}). Adding this dependency (${reason}) would create a cyclic reference.`);
            ^
Error: 'InfrastructureStack' depends on 'MeshedServiceStack' (InfrastructureStack -> MeshedServiceStack/service/CloudmapService/Resource.Name). Adding this dependency (MeshedServiceStack -> InfrastructureStack/Mesh/Resource.MeshName) would create a cyclic reference.
    at MeshedServiceStack._addAssemblyDependency (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/stack.ts:688:13)
    at Object.addDependency (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/deps.ts:52:20)
    at MeshedServiceStack.addDependency (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/stack.ts:445:5)
    at resolveValue (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/private/refs.ts:101:12)
    at Object.resolveReferences (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/private/refs.ts:31:24)
    at Object.prepareApp (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/private/prepare-app.ts:36:5)
    at Object.synthesize (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/private/synthesis.ts:21:3)
    at App.synth (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/stage.ts:175:23)
    at process.<anonymous> (/Users/username/Sandbox/cdk/appmesh-cross-stack-bug/node_modules/@aws-cdk/core/lib/app.ts:112:45)
    at Object.onceWrapper (events.js:422:26)
Subprocess exited with error 1
Environment
- CLI Version : 1.61.1 (build 347918f)
- Framework Version: ^1.61.1
- Node.js Version: v13.12.0
- OS : macOS Catalina 10.15.6
- Language (Version): TypeScript (3.9.7)
Other
This is 🐛 Bug Report
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-appmeshRelated to AWS App MeshRelated to AWS App MeshbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp1