Devin
12/19/2021, 7:42 PM// Create a HTTP API
this.api = new sst.Api(this, "Api", {
defaultAuthorizationType: "AWS_IAM",
defaultFunctionProps: {
environment: {
TABLE_NAME: customersTable.tableName,
},
},
// prettier-ignore
routes: {
"POST /profile": "src/profile/createProfile.main", // this isn't really doing anything but I thought maybe it would help
}
})
this.api.attachPermissions([customersTable]);
const auth = new sst.Auth(this, "Auth", {
cognito: {
userPool: {
signInAliases: { email: true },
},
defaultFunctionProps: {
timeout: 20,
environment: { TABLE_NAME: customersTable.tableName },
permissions: [customersTable],
},
lambdaTriggers: {
postAuthentication: "src/profile/createProfile.main",
},
},
});
Really all that happens in createProfile.main
right now is a console log.
import handler from “../utils/handler”;
import dynamoDb from “../utils/dynamodb”;
export const main = handler(async (event) => {
console.log("[44m%s[0m", `--(event--${JSON.stringify(event)}-----`);
But I can’t see that on signUp. Which i guess sorta makes sense because that’s a service that’s outside of Live Lambda development maybe?
How can I log out the event so I can figure out what I want in my table?Ross Coundon
12/19/2021, 7:48 PMDevin
12/19/2021, 7:55 PMBobby Ross
12/19/2021, 8:00 PMDevin
12/19/2021, 8:01 PMDevin
12/19/2021, 8:01 PMDevin
12/19/2021, 8:24 PMDevin
12/19/2021, 8:53 PMconst auth = new sst.Auth(this, "Auth", {
cognito: {
userPool: {
signInAliases: { email: true },
},
defaultFunctionProps: {
timeout: 20,
environment: { TABLE_NAME: customersTable.tableName },
permissions: [customersTable],
},
triggers: {
postConfirmation: "src/createProfile.main",
},
},
});
Now I’m getting a new error but the database is getting the profile added so 🎉Devin
12/19/2021, 9:00 PMawait dynamoDb.put(params);
// this fails without the follow return in the trigger.
return context.done(null, event);
Thank you both so much!!Ross Coundon
12/20/2021, 8:07 AM