From e88aecd04bf500937b2885bfe54911e77d7190fc Mon Sep 17 00:00:00 2001 From: Madison Jordan Date: Sat, 8 Jul 2023 14:33:42 -0700 Subject: [PATCH] Update week8 journal --- journal/week8.md | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/journal/week8.md b/journal/week8.md index d7b6b26..2aac8ae 100644 --- a/journal/week8.md +++ b/journal/week8.md @@ -6,8 +6,10 @@ > - [Required Homework](#required-homework) #### Weekly Outcome -Week 8 ---- +- Basic knowledge of writing, deploying and logging serverless functions +- Basic knowledge of working with serverless object storage +- Basic knowledge of working with event-bus actions + ## Weekly Summary @@ -15,11 +17,12 @@ Week 8 #### Reflection +This week was extremely difficult. Once again many of my issues were from old environment variables and incorrect policies. #### Challenges - +The lambdas were initially not triggering. I thought it might have been an issue with the ProfileForm.js, but it was an issue with the S3 bucket cors policy and an old gitpod origin in the lambda. The token was not valid and the upload would not start. I looked at the cloudwatch logs for both and attempted to correct the ambiguous errors about "nil class not being defined"/"authorization". I think this was an processing error on the JWT in the authorizer causing the downstream upload to fail. --- ## Knowledge Transfer @@ -32,11 +35,45 @@ Week 8 - You only have to cdk bootstrap once for an account for each region - - #### Questions +Q. Is there any purpose to `cdk synth` other than checking the CloudFormation template before deploying? --- ## Required Homework + + +### Implement CDK Stack +Created CDK Stack + +From the `thumbing-serverless-cdk` directory: +```bash +npm install +cdk synth +cdk deploy +``` + +### Serve Avatars via CloudFront +Process Image Lambda + +Screenshot 2023-06-11 at 5 40 51 PM + +### Implement Users Profile Page +Profile Page with Bio + +Add `bio` column to database in a migration script: +`./bin/db/migrate` + +### Presigned URL generation via Ruby Lambda + +I added the route `/avatars/key_upload` to the API Gateway created under the name `api.kapingkaping.cloud` in the AWS console. I added the Lambda Authorize to this route. + +I had a lot of trouble getting the lambdas working for this week. It took awhile to figure out that I was missing the `https://` in my cors policy on my S3 bucket. I shouldn't watch the video from so far away next time. + +### HTTP API Gateway with Lambda Authorizer +I added `/{proxy+}` to the API Gateway as a route and added the authorizer as an "integration" on it. + +### Render Avatars in App via CloudFront +Render User's Uploaded Avatar +