Skip to content
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

chore(): update lambdas to node20/arm64 #1263

Merged
merged 3 commits into from
May 7, 2024
Merged

Conversation

JoeKarow
Copy link
Member

@JoeKarow JoeKarow commented May 7, 2024

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Enhanced Lambda functions for Cognito messaging and user migration with updated runtime and architecture.
    • Improved error handling in user verification to address specific known request errors.
  • Refactor

    • Streamlined build scripts and modified TypeScript configuration across several Lambda functions.
    • Adjusted database generation commands and paths to reflect new directory structures.
  • Documentation

    • Updated build methods and metadata in Lambda configuration files.
  • Chore

    • Introduced new build targets in Makefiles for better management of Lambda deployments.
  • Bug Fixes

    • Removed outdated ESLint disable comments to maintain code quality standards.

Copy link

vercel bot commented May 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
inreach-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 7, 2024 8:47pm

@github-actions github-actions bot added automerge Enable Kodiak auto-merge kodiak: merge.method = 'squash' Kodiak will squash merge this PR. labels May 7, 2024
Copy link
Contributor

coderabbitai bot commented May 7, 2024

Walkthrough

The recent updates across various Lambda functions and configurations primarily focus on enhancing build processes, updating runtime environments, and refining error handling. Key changes include adopting AWS's SAM for building, transitioning to Node.js 20.x, and shifting to ARM64 architecture. Additionally, error handling and TypeScript configurations have been meticulously adjusted to improve performance and maintainability.

Changes

Files Change Summary
.../cognito-messaging/Makefile, .../cognito-user-migrate/Makefile Introduced and revised build targets in Makefiles.
.../cognito-messaging/package.json, .../cognito-user-migrate/package.json Updated build scripts to use sam build --build-in-source; adjusted paths and commands for AWS Lambda and Prisma generation.
.../cognito-messaging/src/index.ts, .../cognito-user-migrate/src/getUser.ts, .../cognito-user-migrate/src/verifyUser.ts Updated function signatures and error handling in TypeScript files.
.../cognito-messaging/template.yaml, .../cognito-user-migrate/template.yaml Updated Lambda runtime to nodejs20.x, changed architecture to arm64, and introduced new configurations in YAML templates.
.../cognito-messaging/tsconfig.json, .../cognito-user-migrate/tsconfig.json Modified TypeScript compiler options including baseUrl and path mappings.
packages/db/package.json, packages/db/prisma/schema.prisma Updated Prisma generation commands and added a new generator with specific configurations.

This table groups similar file changes and summarizes the modifications succinctly to provide a clear overview of the updates across the system.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@JoeKarow JoeKarow added enhancement Enhancement of the code, not introducing new features. maintenance Generic maintenance tasks. labels May 7, 2024
@JoeKarow JoeKarow changed the title fix: update lambdas to node20/arm64 chore(): update lambdas to node20/arm64 May 7, 2024
Copy link

relativeci bot commented May 7, 2024

#338 Bundle Size — 3.38MiB (0%).

b721ed9(current) vs 7b923e3 dev#333(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  Change 1 change
                 Current
#338
     Baseline
#333
No change  Initial JS 2.98MiB 2.98MiB
No change  Initial CSS 9.54KiB 9.54KiB
Change  Cache Invalidation 49.55% 29.63%
No change  Chunks 67 67
No change  Assets 80 80
No change  Modules 1982 1982
No change  Duplicate Modules 283 283
No change  Duplicate Code 8.21% 8.21%
No change  Packages 207 207
No change  Duplicate Packages 2 2
Bundle size by type  no changes
                 Current
#338
     Baseline
#333
No change  JS 3.26MiB 3.26MiB
No change  Fonts 94.54KiB 94.54KiB
No change  Other 9.6KiB 9.6KiB
No change  CSS 9.54KiB 9.54KiB
No change  IMG 8.57KiB 8.57KiB

Bundle analysis reportBranch JoeKarow/lambda-updatesProject dashboard

Copy link
Contributor

github-actions bot commented May 7, 2024

📦 Next.js Bundle Analysis for @weareinreach/app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

alwaysmeticulous bot commented May 7, 2024

🤖 No test run has been triggered as your Meticulous project has been deactivated (since you haven't viewed any test results in a while). Click here to reactivate.

Last updated for commit b721ed9. This comment will update as new commits are pushed.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7b923e3 and 33f0dc0.
Files selected for processing (13)
  • lambdas/cognito-messaging/Makefile (1 hunks)
  • lambdas/cognito-messaging/package.json (1 hunks)
  • lambdas/cognito-messaging/src/index.ts (2 hunks)
  • lambdas/cognito-messaging/template.yaml (1 hunks)
  • lambdas/cognito-messaging/tsconfig.json (1 hunks)
  • lambdas/cognito-user-migrate/Makefile (1 hunks)
  • lambdas/cognito-user-migrate/package.json (2 hunks)
  • lambdas/cognito-user-migrate/src/getUser.ts (1 hunks)
  • lambdas/cognito-user-migrate/src/verifyUser.ts (2 hunks)
  • lambdas/cognito-user-migrate/template.yaml (2 hunks)
  • lambdas/cognito-user-migrate/tsconfig.json (2 hunks)
  • packages/db/package.json (1 hunks)
  • packages/db/prisma/schema.prisma (1 hunks)
Files skipped from review due to trivial changes (3)
  • lambdas/cognito-messaging/Makefile
  • lambdas/cognito-messaging/tsconfig.json
  • lambdas/cognito-user-migrate/src/getUser.ts
Additional comments not posted (13)
lambdas/cognito-user-migrate/Makefile (1)

3-7: Ensure that the pnpm commands are correctly configured for your environment.

lambdas/cognito-user-migrate/tsconfig.json (2)

4-7: Confirm that the new path mappings align with your project's directory structure.

Verification successful

The shell script execution confirms that the directories referenced in the tsconfig.json path mappings do indeed exist in the repository. Specifically, the script checked for the presence of directories under lambdas/cognito-user-migrate/* and packages/db/*, and both commands returned a list of existing directories and files, which aligns with the paths specified in the tsconfig.json.

Given this information, the path mappings in the tsconfig.json are correctly set according to the current project structure. Therefore, the new path mappings are verified to be accurate and align with the directory structure of the project.


The path mappings in tsconfig.json are correctly aligned with the project's directory structure.

  • The paths ~/* and ~db/* in tsconfig.json correctly map to the directories lambdas/cognito-user-migrate/* and packages/db/* respectively.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the directories referenced in the path mappings exist.

# Test: Check if directories exist.
ls -d lambdas/cognito-user-migrate/* && ls -d packages/db/*

Length of output: 1413


19-19: The isolatedModules flag is set to true, which is good practice to ensure non-transitive modules are correctly handled.

lambdas/cognito-messaging/template.yaml (2)

7-11: Ensure that the runtime and architecture settings are compatible with your deployment targets.


16-30: The addition of a MessageLogGroup with a 30-day retention policy is a good practice for managing logs. Confirm that the log group name and retention settings are as intended.

lambdas/cognito-user-migrate/template.yaml (2)

7-12: Verify that the runtime and architecture settings are correctly configured for the cognito-user-migrate Lambda.


27-31: The MessageLogGroup resource is correctly configured with a 30-day retention policy. Ensure that the log group name is correctly formatted and matches your naming conventions.

lambdas/cognito-messaging/package.json (1)

10-10: The updated build script uses sam build --build-in-source, which is appropriate for building AWS Lambda functions. Ensure that this change is reflected in your CI/CD pipelines.

lambdas/cognito-user-migrate/src/verifyUser.ts (2)

15-15: Ensure that the Prisma query is correctly formed and that the fields selected are necessary for the function's logic.


40-40: The updated error handling for PrismaClientKnownRequestError with specific error code 'P2025' is a good practice for handling known request errors. Ensure that this error code is correctly documented in your project's error handling guidelines.

lambdas/cognito-user-migrate/package.json (1)

Line range hint 10-21: The updated scripts for database generation, building, and client pruning are well-defined. Ensure that these scripts are integrated into your build process and that the paths and options used are correct for your project structure.

lambdas/cognito-messaging/src/index.ts (1)

33-35: The handler function signature has been updated to use a more specific type, enhancing type safety. Confirm that all invocations of this handler are updated to match the new signature.

Verification successful

The search results indicate that the handler function in lambdas/cognito-messaging/src/index.ts is correctly defined with the new signature as CustomMessageTriggerHandler. This matches the expected update mentioned in the review comment. There are no other instances in the codebase where this specific handler function from the cognito-messaging Lambda is invoked incorrectly or with an outdated signature.

Given this information, the update to the handler function signature has been successfully verified, and there are no discrepancies or issues found related to this change in the codebase.

  • File: lambdas/cognito-messaging/src/index.ts
    • The handler function is correctly defined with the type CustomMessageTriggerHandler.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `handler` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript $'handler'

Length of output: 65



Script:

#!/bin/bash
# Description: Verify all function calls to `handler` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts $'handler'

Length of output: 78265

packages/db/prisma/schema.prisma (1)

6-10: The new Prisma generator configuration for ARM64 architecture looks good.

packages/db/package.json Show resolved Hide resolved
packages/db/package.json Outdated Show resolved Hide resolved
lambdas/cognito-user-migrate/Makefile Show resolved Hide resolved
Copy link

sonarcloud bot commented May 7, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 33f0dc0 and b721ed9.
Files selected for processing (1)
  • packages/db/package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/db/package.json

@kodiakhq kodiakhq bot merged commit d6d379d into dev May 7, 2024
32 of 34 checks passed
@kodiakhq kodiakhq bot deleted the JoeKarow/lambda-updates branch May 7, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Enable Kodiak auto-merge 📦 db enhancement Enhancement of the code, not introducing new features. kodiak: merge.method = 'squash' Kodiak will squash merge this PR. maintenance Generic maintenance tasks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants