amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

Circular dependancy Issues

Open ykethan opened this issue 1 year ago • 2 comments

Environment information

System:
  OS: macOS 14.6
  CPU: (8) arm64 Apple M1
  Memory: 282.03 MB / 16.00 GB
  Shell: /opt/homebrew/bin/fish
Binaries:
  Node: 20.2.0 - ~/.nvm/versions/node/v20.2.0/bin/node
  Yarn: 1.22.19 - ~/.nvm/versions/node/v20.2.0/bin/yarn
  npm: 10.8.2 - ~/Documents/ampapps/backenddevtest/amplify-next-pages-template/node_modules/.bin/npm
  pnpm: 8.13.1 - ~/.nvm/versions/node/v20.2.0/bin/pnpm
NPM Packages:
  @aws-amplify/auth-construct: Not Found
  @aws-amplify/backend: 1.0.4
  @aws-amplify/backend-auth: Not Found
  @aws-amplify/backend-cli: 1.2.2
  @aws-amplify/backend-data: Not Found
  @aws-amplify/backend-deployer: Not Found
  @aws-amplify/backend-function: Not Found
  @aws-amplify/backend-output-schemas: Not Found
  @aws-amplify/backend-output-storage: Not Found
  @aws-amplify/backend-secret: Not Found
  @aws-amplify/backend-storage: Not Found
  @aws-amplify/cli-core: Not Found
  @aws-amplify/client-config: Not Found
  @aws-amplify/deployed-backend-client: Not Found
  @aws-amplify/form-generator: Not Found
  @aws-amplify/model-generator: Not Found
  @aws-amplify/platform-core: Not Found
  @aws-amplify/plugin-types: Not Found
  @aws-amplify/sandbox: Not Found
  @aws-amplify/schema-generator: Not Found
  aws-amplify: 6.4.3
  aws-cdk: 2.150.0
  aws-cdk-lib: 2.150.0
  typescript: 5.5.4
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Description

Issue tracking CloudFormation circular dependancy behavior

Current issue noting circular dependancy:

https://github.com/aws-amplify/amplify-backend/issues/1552 https://github.com/aws-amplify/amplify-category-api/issues/2554 https://github.com/aws-amplify/amplify-backend/issues/1723 https://github.com/aws-amplify/amplify-backend/issues/1740 https://github.com/aws-amplify/amplify-backend/issues/1715 https://github.com/aws-amplify/amplify-backend/issues/1659 https://github.com/aws-amplify/amplify-backend/issues/1658 https://github.com/aws-amplify/amplify-backend/issues/1699 https://github.com/aws-amplify/amplify-backend/issues/1594 https://github.com/aws-amplify/amplify-backend/issues/1459 https://github.com/aws-amplify/amplify-backend/issues/1375 https://github.com/aws-amplify/amplify-backend/issues/1803

ykethan avatar Aug 12 '24 20:08 ykethan

I recently worked on the Gen 2 project and encountered above mentioned challenges. In my experimental project, I aimed to implement the following components:

  • Custom lambda authentication for data (using Cognito's JWKS to identify logged-in users, where the access token is a Cognito ID token wrapped in a custom format).
  • Overrides for some data create/update/delete mutations.
  • DynamoDB Stream handler.
  • An SQS to process messages.

In Gen 2, the root stack contains "auth," "data," and "function," which leads to circular dependency issues. To address this, I set up the local environment and ensured that each function is created in its own stack. This approach seems to be working well so far, but I am unsure if there are any other potential consequences that have not been addressed by this change.

image

Is this the right place to discuss this?

Edit 1: I also noticed that with this change, I was able to make use of the helper functions like "grantStreamRead", "grantSendMessages", "addEventSource"

juniarz avatar Aug 31 '24 16:08 juniarz