I haven't been able to set the SES Region and FROM...
# sst
j
I haven't been able to set the SES Region and FROM address ARN in Cognito using cdk
f
Hey @Jason Pascoe What’s the error you are getting?
j
Cannot configure From email address for default email configuration (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: 27d568c5-ba96-46c3-b090-b6df4eee79b7; Proxy: null)
thats using
Copy code
emailSettings: { from: "<mailto:info@animaltrack.me|info@animaltrack.me>", replyTo: "<mailto:info@animaltrack.me|info@animaltrack.me>" }
I havent found where to set region and arn
I'm assuming it has something to do with verificationMessageConfiguration but havent found parameters for it yet
f
Are you getting the error on
sst deploy
?
j
yes. Ive also tried emailConfiguration but that is ignored. This stackoverflow is basically what I'm trying to do but I want to do it using sst https://stackoverflow.com/a/63852920
f
I see. Can you paste here the code you are using for creating the UserPool?
j
Copy code
const userPool = new cognito.UserPool(this, "UserPool", {
    selfSignUpEnabled: true, // Allow users to sign up
    signInCaseSensitive: false,
    autoVerify: { email: true }, // Verify email addresses by sending a verification code
    signInAliases: { email: true }, // Set email as an alias
    // emailSettings: {
    //     from: "<mailto:info@animaltrack.me|info@animaltrack.me>",
    //     replyTo: "<mailto:info@animaltrack.me|info@animaltrack.me>",
    //     sourceArn: `arn:aws:ses:eu-west-1:614261509776:identity/info@animaltrack.me`
    // }, //arn:aws:ses:ap-southeast-2:614261509776:identity/info@animaltrack.me
    userVerification: {
        emailSubject: "Your Animal Incident Reporting verification code",
        emailBody: "Your Animal Incident Reporting verification code is {####}.",
        emailStyle: VerificationEmailStyle.CODE,
        smsMessage: "Your Animal Incident Reporting verification code is {####}."
    },
    userInvitation: {
        emailSubject: "Your temporary Animal Incident Reporting password",
        emailBody: "Your username is {username} and temporary password is {####}.",
        smsMessage: "Your username is {username} and temporary password is {####}."
    },
    passwordPolicy: {
        tempPasswordValidity: Duration.days(7),
        minLength: 8,
        requireLowercase: true,
        requireUppercase: true,
        requireDigits: true,
        requireSymbols: false
    },
    emailConfiguration: {
        from: "<mailto:info@animaltrack.me|info@animaltrack.me>",
        replyToEmailAddress: "<mailto:info@animaltrack.me|info@animaltrack.me>",
        sourceArn: `arn:aws:ses:eu-west-1:614261509776:identity/info@animaltrack.me`
    }
});
f
Got it. Gimme 1 sec to check the CDK docs.
f
So yeah, as of the latest CDK version, the EmailConfigurationProperty is still not supported in high level User Pool construct.
You should use the solution in the stackoverflow answer (rewrite java in js 🙂)
so something like
Copy code
// your code
const userPool = new cognito.UserPool(...)

// stackoverflow answer here
userPool.node.defaultChild.setEmailConfiguration(...)
j
TypeError: userPool.node.defaultChild.setEmailConfiguration is not a function
looking into it at the moment
f
Had a look at the doc again, try this
Copy code
userpool.node.defaultChild.emailConfiguration = ...
j
Ill try that then leave for now, still have to setup auth
f
Yeah I’m sure this is doable. Just need to figure out the right syntax.
j
Thanks for the pointers, maybe something to add to the docs
All tested and working