Simon Reilly
09/21/2021, 5:12 PMSimon Reilly
09/21/2021, 5:13 PMFrank
Simon Reilly
09/21/2021, 6:48 PMconst customResourceProps: CognitoCustomResource = {
service: 'CognitoIdentityServiceProvider',
action: 'updateUserPoolClient',
physicalResourceId: PhysicalResourceId.of(
'UniqueIdentityReference-000100'
),
parameters: {
ClientId: String(auth.cognitoUserPoolClient?.userPoolClientId),
UserPoolId: String(auth.cognitoUserPool?.userPoolId),
CallbackURLs: [
`https://${site.cfDistribution.distributionDomainName}/api/auth/callback/cognito`,
],
LogoutURLs: [`https://${site.cfDistribution.distributionDomainName}`],
},
};
// Replace OAuth callback URLs
new AwsCustomResource(this, 'API1', {
onCreate: customResourceProps,
onUpdate: customResourceProps,
policy: AwsCustomResourcePolicy.fromSdkCalls({
resources: AwsCustomResourcePolicy.ANY_RESOURCE,
}),
});
Simon Reilly
09/21/2021, 6:48 PMFrank
Simon Reilly
09/21/2021, 6:49 PMSimon Reilly
09/21/2021, 6:50 PMSimon Reilly
09/21/2021, 6:50 PM// Deploy the next JS Site
const site = new sst.NextjsSite(this, 'Site', {
path: 'src/frontend/site',
environment: {
// site ? this ? difficult one
NEXTAUTH_URL: `https://${site.cfDistribution.distributionDomainName}`,
},
});
Simon Reilly
09/21/2021, 6:50 PMSimon Reilly
09/21/2021, 6:51 PM// Deploy the next JS Site
const site = new sst.NextjsSite(this, 'Site', {
path: 'src/frontend/site',
environment: {
// site ? this ? difficult one
NEXTAUTH_URL: (self: Construct) => `https://${self.cfDistribution.distributionDomainName}`,
},
});
Is this possible?Frank
Frank
Simon Reilly
09/26/2021, 2:16 PMFrank
Frank
Simon Reilly
09/28/2021, 8:02 PMSimon Reilly
09/28/2021, 8:09 PMSimon Reilly
09/30/2021, 7:10 AMLambda@Edge functions can also be associated with additional behaviors, either at or after Distribution creation time.I got a circular dependency, which to me means, addBehavior is just updating the distribution node, not creating a custom resource that modifies it after deploy âšī¸
Frank
const site = new sst.NextjsSite(this, 'Site', {
path: 'src/frontend/site',
environment: {
NEXTAUTH_URL: sst.NextjsSite.DISTRIBUTION_DOMAIN_NAME,
},
});
Essentially NextjsSite provides a bunch of static constantsSimon Reilly
09/30/2021, 8:31 AM