Open DarylSerrano opened 5 months ago
Hey @DarylSerrano, I was facing this same issue and upon digging a bit deeper into it, I found it was an issue with the cloudformation templates.
The amplify app is exported as one root stack with multiple nested stacks (auth + graphql api) for your case. The authRole
and unauthRole
are created by amplify while initializing auth in your project and you may see these parameters referenced/listed across the project, e.g in your team provider. They are parameters of the root stack and this can be seen as such from the amplify-export-<app-name>/root-stack-template.json
under the Parameters
object.
Within the same file, you will a separate entry for Resources
which should contain your auth
and api (appsync)
nested stacks for your case. It is from here that you can pass/reference params from the root stack into nested stacks.
Assuming your api is named test, you would notice such an entry:
"apitest": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"Parameters": {
"AuthCognitoUserPoolId": {
"Fn::GetAtt": [
"authjumbaauth",
"Outputs.UserPoolId"
]
}
}
}
},
Under Parameters
, notice authRoleName
and unauthRoleName
are not being passed despite being required in the cloudformation template of said api - which would be at amplify-export-<app-name>/api/test/cloudformation-template.json
. Ideally, this section would need to be:
"apitest": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"Parameters": {
"AuthCognitoUserPoolId": {
"Fn::GetAtt": [
"authjumbaauth",
"Outputs.UserPoolId"
]
},
"authRoleName": {
"Ref": "AuthRoleName"
},
"unauthRoleName": {
"Ref": "UnauthRoleName"
}
}
}
},
This seems to be issue with how the amplify export command is working and you can get around it by having a script to add in the omitted params that would run post amplify export.
I have and amplify app that has an API Graphql and Auth. Both created from amplify cli. I then exported the amplify app using
amplify export --out <your-cdk-project-location>
following this guideI then proceeded to add in into a CDK project to deploy it on another account and region following this guide
After running deploy I am getting this error:
Expected Behavior stack should be deployed in the account and region
This works if I remove the auth, export the amplify app again and only deploy the api.
Node version: v20.10.0 Amplify CLI version: 12.10.1