aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
158 stars 54 forks source link

Another dependency problem: with cfnIdentityPool #1803

Closed OperationalFallacy closed 1 month ago

OperationalFallacy commented 1 month ago

Environment information

Binaries:
  Node: 20.15.0 - ~/.n/bin/node
  Yarn: 4.3.1 - ~/.n/bin/yarn
  npm: 10.7.0 - ~/.n/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/backend: 1.0.4
  @aws-amplify/backend-cli: 1.2.0
  aws-amplify: 6.4.0
  aws-cdk: 2.149.0
  aws-cdk-lib: 2.149.0
  typescript: 5.5.3

Description

export const backend = defineBackend({
  auth,
  data,
  storage,
  idLinker
})

// Fails with usual ❌  amplify- failed: Error [ValidationError]: Circular dependency between resources: [storagexxx, dnsxxx, sesxxx, authxxx, dataxxx, docprocxxx, functionxxx]
backend.idLinker.addEnvironment("IDENTITY_POOL_ID", backend.auth.resources.cfnResources.cfnIdentityPool.ref)

I had to comment it out, deploy all other changes, uncomment - only then it works.

The use case is to get identity pool for the mutation Lambda that queries Cognito with GetIdCommand, function also has graphql and auth access configured on respective resources

ykethan commented 1 month ago

Thank you for the reporting this. This behavior is currently being tracked on https://github.com/aws-amplify/amplify-backend/issues/1850. Closing this issue.