-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TRACKING] Nested stack runtime-config.json properties #84
Comments
Hi Martin! Thanks for raising this issue and I am glad you are enjoying the PDK :) I had a quick look and it appears that this is actually caused by a limitation of the There is a workaround that could be done as follows: 1.) In the stack where you instantiate the Here is some sample code which I have tested and can confirm resolves the issue: export class ParentStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps = {}) {
super(scope, id, props);
const nestedStack = new NestedStack(this, 'NestedStack');
const userIdentity = new UserIdentity(nestedStack, 'UserIdentity');
const userPoolId = new StringParameter(this, 'UserPoolId', {
parameterName: 'UserPoolId',
stringValue: userIdentity.userPool.userPoolId,
});
const userPoolClientId = new StringParameter(this, 'UserPoolClientId', {
parameterName: 'UserPoolClientId',
stringValue: userIdentity.userPoolClient?.userPoolClientId || '',
});
const identityPoolId = new StringParameter(this, 'IdentityPoolId', {
parameterName: 'IdentityPoolId',
stringValue: userIdentity.identityPool.identityPoolId,
});
new StaticWebsite(this, 'StaticWebsite', {
websiteContentPath: path.join(__dirname, 'website'),
runtimeOptions: {
jsonPayload: {
region: Stack.of(this).region,
identityPoolId: identityPoolId.stringValue,
userPoolId: userPoolId.stringValue,
userPoolWebClientId: userPoolClientId.stringValue,
},
},
});
}
} I have changed this issue to a TRACKING issue as there are no changes to be implemented on the PDK side. I hope this resolves your issue :) |
In regard to the Appsync construct - we have plans to vend a Declarative AppSync construct in the future, similar to the OpenApiGateway construct. The plan would be for you to just define your data model, mutations, queries, etc and the construct will handle all the wiring to lambdas, resolvers (including pipelined ones), validations, etc. |
Yep, I thought that will be on your roadmap as this fits perfectly into prototype-ish. Looking forward to the AppSync construct :) Thanks for looking into this :). I can confirm the workaround works. |
Describe the bug
For my startup-ish prototype project based on CDK and Projen, I like to use Amplify AppSync. Kenneth Winner did a nice construct around it a while back https://www.npmjs.com/package/cdk-appsync-transformer . Unlucky the AppSync is wrapped in a nested stack. So when I take an output from that nested stack I can't use it for the runtime-config.json.
For completion, I don't use the StaticWebsite directly. I found that runtimeOptions part very inspiring so, I incorporated it into my project. But yeah it is fairly simple so you should have the same problem in your amazing construct.
Expected Behavior
No error is thrown.
Current Behavior
An error is thrown like:
failed: Error [ValidationError]: Template error: instance of Fn::GetAtt references undefined resource apiC8550315
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
PDK version used
0.0.0
What languages are you seeing this issue on?
Typescript
Environment details (OS name and version, etc.)
MacOs
The text was updated successfully, but these errors were encountered: