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.

(apigatewayv2): cyclic dependency introduced when HttpApi and Route are in different stacks

See original GitHub issue

Please add your +1 👍 to let us know you have encountered this

Status: INVESTIGATING

Overview:

From @hoegertn:

The changes in #12528 introduced a regression when having the following setup:

ApiStack -> ChildStack with Lambda, HttpRoute, etc

By moving the instantiation of the HttpIntegration class to the HttpApi. _addIntegration method the scope was changed from the Route to the HttpApi object. This leads to a cyclic reference in the architecture described above.

So starting with 1.87.0 all my ApiGateway applications no longer synthesize.

Complete Error Message:

'myapp-backend-pipeline/myapp-backend-dev/Api' depends on 'myapp-backend-pipeline/myapp-backend-dev/Api/Config' (myapp-backend-pipeline/myapp-backend-dev/Api -> myapp-backend-pipeline/myapp-backend-dev/Api/Config/Fncors/Resource.Arn, myapp-backend-pipeline/myapp-backend-dev/Api -> myapp-backend-pipeline/myapp-backend-dev/Api/Config/Fnopenapi/Resource.Arn). Adding this dependency (myapp-backend-pipeline/myapp-backend-dev/Api/Config -> myapp-backend-pipeline/myapp-backend-dev/Api/Api/Resource/Resource.Ref) would create a cyclic reference.
Error: 'myapp-backend-pipeline/myapp-backend-dev/Api' depends on 'myapp-backend-pipeline/myapp-backend-dev/Api/Config' (myapp-backend-pipeline/myapp-backend-dev/Api -> myapp-backend-pipeline/myapp-backend-dev/Api/Config/Fncors/Resource.Arn, myapp-backend-pipeline/myapp-backend-dev/Api -> myapp-backend-pipeline/myapp-backend-dev/Api/Config/Fnopenapi/Resource.Arn). Adding this dependency (myapp-backend-pipeline/myapp-backend-dev/Api/Config -> myapp-backend-pipeline/myapp-backend-dev/Api/Api/Resource/Resource.Ref) would create a cyclic reference.
    at BackendApiImplStack._addAssemblyDependency (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/stack.ts:724:13)
    at Object.addDependency (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/deps.ts:52:20)
    at BackendApiImplStack.addDependency (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/stack.ts:479:5)
    at resolveValue (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/private/refs.ts:103:12)
    at Object.resolveReferences (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/private/refs.ts:33:24)
    at Object.prepareApp (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/private/prepare-app.ts:31:3)
    at Object.synthesize (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/private/synthesis.ts:24:3)
    at myappBackendStage.synth (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/stage.ts:188:23)
    at synthNestedAssemblies (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/private/synthesis.ts:52:13)
    at synthNestedAssemblies (/Users/hoegertn/repo/myapp/backend/node_modules/@aws-cdk/core/lib/private/synthesis.ts:54:7)

Workaround:

Solution:

Related Issues:

First reported by @hoegertn: #13007

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
hoegertncommented, Feb 15, 2021

Given that it is broken since 1.87.0 this is fine for me. It only happens in multi-stack setups and not many people might do this.

1reaction
nija-atcommented, Feb 15, 2021

Since we’ve had only one report in 6 days (since the latest release), I’m reducing the priority of this issue to a p1. I’ll re-raise the priority if this changes substantially.

We’re actively working on fixing this for the next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk/aws-apigatewayv2 module - AWS Documentation
This module supports features under API Gateway v2 that lets users set up Websocket and HTTP APIs. REST APIs can be created using...
Read more >
Find Answers to AWS Questions about Amazon API Gateway
Browse through Amazon API Gateway questions or showcase your expertise by answering unanswered questions.
Read more >
@aws-cdk/aws-apigatewayv2 | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
aws/aws-cdk v1.57.0 on GitHub - NewReleases.io
the key route . eks: The experimental eks. ... apigatewayv2: cyclic dependency between HttpApi and the lambda function (#9100) (7b29774), closes #9075.
Read more >
software.amazon.awscdk:config: Versions | Openbase
appmesh: add timeout support to Routes (#11973) (78c185d) ... apigatewayv2: cyclic dependency between HttpApi and the lambda function (#9100) (7b29774), ...
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