You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normally one would deploy a CDK project simply by typing cdk deploy on the commandline (assuming you are in the correct folder and all the prerequisites are in place). In our case we need to use the non-standard entrypoint deploy.bat. The reason for this is that there seems to be an issue in CDK when creating an AppSync API that uses a cross-stack UserPool for authentication. Specifically the following snippet from the generated JSON
The CDK uses the AwsRegion of the AppSync API instead of the AwsRegion of the UserPool itself in the UserPoolConfig. In ourcase we want the API to be in af-south-1 (to minimise latency) but af-south-1 does not support Cognito so the Userpool needs to be elsewhere (in our case we chose eu-west-2). A simple edit to the generated JSON fixes the problem, but since this is autogenerated we need to re-apply the edit each time cdk synth runs. This is exactly what deploy.bat and fixup.py (which is called by deploy.bat) implements.
This is very far from ideal. Ideally we would like this fixed inside CDK itself. I stepped through some of the relevant code, but there are many layers of abstraction and I eventually gave up. We should submit an issue on the CDK repository but to have any chance of being taken seriously we should include a minimal reproducible example and even then I think out chances of success are slim (this is obviously not a very common issue or Cognito would just be supported on all regions and we could dispense with all the cross stack complexity.)
Some other issues are
The use of .bat file ties the deploy environment to windows.
Both deploy.bat and fixup.py currently contain hard-coded references to the current environment detweb-stack-develop which means that things break when the environment changes.
fixup.py also contains a hardcoded reference to eu-west-2, so if someone wants to deploy their cognito stack somewhere else, this would also break.
Amplify supports deployment of a fullstack app directly from the AWS console, by simply pointing to a github repo and a single click see example here. While we do not currently use Amplify in this way, it could be done in future, but not as long as this fixup step is required.
The text was updated successfully, but these errors were encountered:
Normally one would deploy a CDK project simply by typing cdk deploy on the commandline (assuming you are in the correct folder and all the prerequisites are in place). In our case we need to use the non-standard entrypoint deploy.bat. The reason for this is that there seems to be an issue in CDK when creating an AppSync API that uses a cross-stack UserPool for authentication. Specifically the following snippet from the generated JSON
The CDK uses the AwsRegion of the AppSync API instead of the AwsRegion of the UserPool itself in the UserPoolConfig. In ourcase we want the API to be in af-south-1 (to minimise latency) but af-south-1 does not support Cognito so the Userpool needs to be elsewhere (in our case we chose eu-west-2). A simple edit to the generated JSON fixes the problem, but since this is autogenerated we need to re-apply the edit each time cdk synth runs. This is exactly what deploy.bat and fixup.py (which is called by deploy.bat) implements.
This is very far from ideal. Ideally we would like this fixed inside CDK itself. I stepped through some of the relevant code, but there are many layers of abstraction and I eventually gave up. We should submit an issue on the CDK repository but to have any chance of being taken seriously we should include a minimal reproducible example and even then I think out chances of success are slim (this is obviously not a very common issue or Cognito would just be supported on all regions and we could dispense with all the cross stack complexity.)
Some other issues are
The text was updated successfully, but these errors were encountered: