Closed marcomilon closed 1 month ago
Update
If i use a custom authorization rule with a Lambda function. see https://docs.amplify.aws/react/build-a-backend/data/customize-authz/custom-data-access-patterns/
Everything works as expected.
Hey @marcomilon, thank you for reaching out. Connecting an existing auth resource to the backend is currently not yet supported and is being tracked on https://github.com/aws-amplify/amplify-backend/issues/1548 RFC(request for comment) But i do think we could add a callout on the documentation on this behavior. Marking this as documentation.
Closing this as a callout had been adding to the documentation referencing the RFC: https://docs.amplify.aws/react/build-a-backend/auth/use-existing-cognito-resources/#use-auth-resources-with-an-amplify-backend
Environment information
Description
How to reproduce
npx ampx sandbox
The Sandbox failed to build with this error. See Your CloudFormation for details.
data/amplifyData/AuthRolePolicy01 (amplifyDataAuthRolePolicy01567A5654) Resource handler returned message: "The role with name undefined cannot be found. (Service: Iam, Status Code: 404, Request ID: xxxx" (RequestToken: xxxxxxx, HandlerErrorCode: NotFound)
and
data/amplifyData/UnauthRolePolicy01 (amplifyDataUnauthRolePolicy01355B9DCF) Resource handler returned message: "The role with name undefined cannot be found. (Service: Iam, Status Code: 404, Request ID: xxx)" (RequestToken:xxxx, HandlerErrorCode: NotFound)
and more...
Expected result Sandbox builds successfully and uses existing datasource and existing Cognito.
Note If a define a new Cognito resource with
defineAuth(
inside amplify/auth/resources.ts everything works as expected.