Skip to content

Conversation

@jkomyno
Copy link
Contributor

@jkomyno jkomyno commented Aug 20, 2025

This PR:

Summary by CodeRabbit

  • New Features

    • AWS Lambda example providing a GET endpoint that returns sample quotes using Prisma, SST, and ESBuild.
  • Documentation

    • Added a getting-started guide covering prerequisites, env setup, migrations, client generation, bundling, local run, secrets handling, and deployment.
  • Chores

    • Project scaffolding: package scripts, TypeScript config, environment typings, infrastructure config, seed data, and .gitignore for build/cache/log/generated artifacts.

@coderabbitai
Copy link

coderabbitai bot commented Aug 20, 2025

Walkthrough

Adds a new Prisma + AWS Lambda + SST + esbuild example under generator-prisma-client/aws-lambda-sst-esbuild: project config, ESM Prisma client generation, SST infra and typings, Lambda handler, DB adapter, seed script, README, package/build configs, and .gitignore.

Changes

Cohort / File(s) Summary of Changes
Docs & Ignore
generator-prisma-client/aws-lambda-sst-esbuild/README.md, generator-prisma-client/aws-lambda-sst-esbuild/.gitignore
Adds README with prerequisites, setup, commands, secrets and deploy guidance. Adds .gitignore for dist artifacts, lambda.zip, node/yarn caches, IDE files (with negations), env files, logs, .sst, and generated Prisma output.
Package & TS config
generator-prisma-client/aws-lambda-sst-esbuild/package.json, generator-prisma-client/aws-lambda-sst-esbuild/tsconfig.json
Adds ESM package.json (name, type, scripts: build/deploy/zip), dependencies/devDependencies and pinned pnpm. Adds tsconfig for ESNext target, Bundler moduleResolution, strict checks, and Node typings.
SST infra & typings
generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts, generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts
Adds SST config declaring DIRECT_URL secret and creating an AWS Lambda function (nodejs20.x, arm64, URL enabled) linked to secrets. Adds ambient SST typings augmenting Resource for DIRECT_URL and the function.
Prisma config & schema
generator-prisma-client/aws-lambda-sst-esbuild/prisma.config.ts, generator-prisma-client/aws-lambda-sst-esbuild/prisma/schema.prisma
Adds prisma.config.ts with schema and seed command. Adds schema.prisma with PostgreSQL datasource using DATABASE_URL/DIRECT_URL, ESM Prisma client generator output (../src/generated/prisma), QuoteKind enum, and Quotes model.
Seeding
generator-prisma-client/aws-lambda-sst-esbuild/prisma/seed.ts
Adds seed script that clears quotes and inserts sample records (uses skipDuplicates, logs timing and progress).
App code
generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts, generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts, generator-prisma-client/aws-lambda-sst-esbuild/src/prisma-enums.ts
Adds Lambda handler (GET returns up to 2 quotes; 405 for other methods; 500 on error). Adds DB factory using @prisma/adapter-pg and generated Prisma client (getDb + exported types). Re-exports generated Prisma enums.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant API as API Gateway (HTTP API)
  participant Lambda as Lambda Handler
  participant Prisma as Prisma Client
  participant PG as PostgreSQL

  User->>API: HTTP GET (Lambda URL)
  API->>Lambda: invoke(event)
  alt Method ≠ GET
    Lambda-->>API: 405 {"error":"Method Not Allowed"} + Allow: GET
  else GET
    Lambda->>Prisma: prisma.quotes.findMany({ take: 2 })
    Prisma->>PG: SQL SELECT ... LIMIT 2
    PG-->>Prisma: rows
    Prisma-->>Lambda: quotes[]
    Lambda-->>API: 200 {"data":[...]}
  end
  API-->>User: HTTP response
Loading

Possibly related PRs

Suggested reviewers

  • mhessdev
  • nurul3101
  • nikolasburk

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/prisma-client-aws-lambda-sst

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • 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.
  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

Copy link

@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: 17

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bc6c028 and 8377df8.

⛔ Files ignored due to path filters (1)
  • generator-prisma-client/aws-lambda-sst-esbuild/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (12)
  • generator-prisma-client/aws-lambda-sst-esbuild/.gitignore (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/README.md (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/package.json (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/prisma.config.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/prisma/schema.prisma (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/prisma/seed.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/src/prisma-enums.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/tsconfig.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (1)
generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts (1)
  • Resource (7-17)
🪛 LanguageTool
generator-prisma-client/aws-lambda-sst-esbuild/README.md

[grammar] ~1-~1: Use correct spacing
Context: ...S Lambda + SST + ESBuild + Node.js + ESM This project showcases how to use the Pr...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~3-~3: Use articles correctly
Context: ... the Prisma ORM with Prisma Postgres in an TypeScript application transpiled to Co...

(QB_NEW_EN_OTHER_ERROR_IDS_11)


[grammar] ~3-~3: Use correct spacing
Context: ...nspiled to CommonJS (CJS) using ESBuild. ## Prerequisites To successfully run the p...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~5-~5: Use correct spacing
Context: ...S (CJS) using ESBuild. ## Prerequisites To successfully run the project, you wil...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~7-~7: Use correct spacing
Context: ...he project, you will need the following: - Two Prisma Postgres connection strin...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~9-~9: There might be a mistake here.
Context: ... Prisma Postgres connection strings: - Your **Prisma Postgres + Accelerate conn...

(QB_NEW_EN)


[grammar] ~10-~10: There might be a mistake here.
Context: ...ring** (containing your Prisma API key) which you can get by enabling Postgres ...

(QB_NEW_EN_OTHER)


[grammar] ~11-~11: There might be a mistake here.
Context: ...ma Postgres direct TCP connection string** which you will use with Prisma Client. ...

(QB_NEW_EN_OTHER)


[grammar] ~11-~11: There might be a problem here.
Context: ...* which you will use with Prisma Client. Learn more in the [docs](https://www.pr...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~12-~12: Use correct spacing
Context: ...s/postgres/database/direct-connections). ## Tech Stack - Next.js 15 - Runtime: No...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~14-~14: Use correct spacing
Context: ...base/direct-connections). ## Tech Stack - Next.js 15 - Runtime: Node.js 20.19.0 ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~16-~16: There might be a mistake here.
Context: ...nnections). ## Tech Stack - Next.js 15 - Runtime: Node.js 20.19.0 - Bundler: es...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ... Next.js 15 - Runtime: Node.js 20.19.0 - Bundler: esbuild - package.json cont...

(QB_NEW_EN)


[grammar] ~18-~18: Use correct spacing
Context: ...me: Node.js 20.19.0 - Bundler: esbuild - package.json contains { "type": "module" } - `esb...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~19-~19: Use correct spacing
Context: ...er: esbuild - package.json contains { "type": "module" } - esbuild specifies --format=esm, `--platform=n...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~20-~20: Use correct spacing
Context: ... --format=esm, --platform=node, and --target=node20 - Prisma Client with the prisma-client g...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~21-~21: There might be a mistake here.
Context: ...lient with the prisma-client generator See the [Prisma schema file](./prisma/sc...

(QB_NEW_EN_OTHER)


[grammar] ~22-~22: Use correct spacing
Context: ...le](./prisma/schema.prisma) for details. prisma generator client { provider = "prisma-client" output = "../src/generated/prisma" previewFeatures = ["driverAdapters", "queryCompiler"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") directUrl = env("DIRECT_URL") } ## Getting started ### 1. Clone the reposi...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~38-~38: Use correct spacing
Context: ...RECT_URL") } ``` ## Getting started ### 1. Clone the repository Clone the repos...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~40-~40: There might be a mistake here.
Context: ...ing started ### 1. Clone the repository Clone the repository, navigate into it a...

(QB_NEW_EN_OTHER)


[grammar] ~42-~42: There might be a mistake here.
Context: ...ry Clone the repository, navigate into it and install dependencies: ``` git clon...

(QB_NEW_EN_OTHER)


[grammar] ~42-~42: Use correct spacing
Context: ...vigate into it and install dependencies: git clone git@github.com:prisma/prisma-examples.git --depth=1 cd prisma-examples/generator-prisma-client/aws-lambda-sst-esbuild pnpm install ### 2. Configure environment variables Crea...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~50-~50: There might be a mistake here.
Context: ... ### 2. Configure environment variables Create a .env in the root of the proje...

(QB_NEW_EN_OTHER)


[grammar] ~52-~52: Use correct spacing
Context: ...vin the root of the project directory: ```bash touch .env ``` Now, open the.envfile and set theD...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~58-~58: Use correct spacing
Context: ... your Prisma Postgres connection string: bash # .env # Prisma Postgres connection string (used for migrations) DATABASE_URL="__YOUR_PRISMA_POSTGRES_CONNECTION_STRING__" # Postgres connection string (used for queries by Prisma Client) DIRECT_URL="__YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__" NEXT_PUBLIC_URL="http://localhost:3000" Note that `__YOUR_PRISMA_POSTGRES_CONNEC...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~72-~72: Use correct spacing
Context: ...isma-data.net/?api_key=<api_key_value>. Note that __YOUR_PRISMA_POSTGRES_DIRECT...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~74-~74: Use correct spacing
Context: ...e>:@:/`. ### 3. Run a migration to create the databas...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~76-~76: There might be a mistake here.
Context: ...database structure and seed the database The [Prisma schema file](./prisma/schema...

(QB_NEW_EN_OTHER)


[grammar] ~78-~78: Use correct spacing
Context: ...otestable using the following command: ``` pnpm prisma migrate dev --name init ``` You now have an emptyQuotes` table in ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~84-~84: Use correct spacing
Context: ...create some sample records in the table: pnpm prisma db seed ### 4. Generate Prisma Client Run: ``` pnp...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~90-~90: Use correct spacing
Context: ... seed ### 4. Generate Prisma Client Run: pnpm prisma generate ``` ### ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~92-~92: Use correct spacing
Context: ... ### 4. Generate Prisma Client Run: pnpm prisma generate ### 5. Bundle the project Run pnpm run...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~98-~98: There might be a mistake here.
Context: ... generate ### 5. Bundle the project Run pnpm run build ``` ### 6. Run ...

(QB_NEW_EN_OTHER)


[grammar] ~100-~100: Use correct spacing
Context: ...rate ### 5. Bundle the project Run pnpm run build ``` ### 6. Run with SST - Ensure you set up you...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~106-~106: Use proper capitalization
Context: ... pnpm run build ``` ### 6. Run with SST - Ensure you set up your AWS Credentials a...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~108-~108: There might be a mistake here.
Context: ...ocs](https://sst.dev/docs/aws-accounts)) - Set up secrets in your SST project. You ...

(QB_NEW_EN_OTHER)


[grammar] ~109-~109: There might be a mistake here.
Context: ...ts in your SST project. You can do this by: - Manually adding the DIRECT_URL connection stri...

(QB_NEW_EN_OTHER)


[grammar] ~110-~110: There might be a problem here.
Context: ...t you previously set in your .env file, via: pnpm sst secrets add DIRECT_URL __YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__ - Or, by loading the .env file first and...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~114-~114: Use correct spacing
Context: ...ing it to the sst secrets add command: pnpm dotenv -- bash -c 'pnpm sst secret set DIRECT_URL "${DIRECT_URL}"' - Run the following command to deploy the ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~124-~124: Use correct spacing
Context: ...ou should see an output similar to this: sh ❯ pnpm sst deploy SST 3.17.10 ready! ➜ App: prisma-client-aws-lambda-sst Stage: prisma ~ Deploy | Created aws-lambda sst:aws:Function → aws-lambdaCode aws:s3:BucketObjectv2 (2.3s) | Created aws-lambda sst:aws:Function → aws-lambdaSourcemap0 aws:s3:BucketObjectv2 (6.1s) | Updated aws-lambda sst:aws:Function → aws-lambdaFunction aws:lambda:Function (12.7s) | Deleted aws-lambda sst:aws:Function → aws-lambdaCode aws:s3:BucketObjectv2 ↗ Permalink https://sst.dev/u/<...> ✓ Complete aws-lambda: https://<...>.lambda-url.us-east-1.on.aws/ ## Resources - [Prisma Postgres documentat...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~146-~146: Use correct spacing
Context: ...-url.us-east-1.on.aws/ ``` ## Resources - [Prisma Postgres documentation](https://w...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~148-~148: There might be a mistake here.
Context: ...ources - Prisma Postgres documentation - Check out the [Prisma docs](https://www....

(QB_NEW_EN)


[grammar] ~150-~150: There might be a mistake here.
Context: ... feedback and interact with other users. - [Subscribe to our YouTube channel](https:...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
generator-prisma-client/aws-lambda-sst-esbuild/README.md

44-44: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


80-80: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


86-86: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


94-94: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


102-102: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


111-111: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


111-111: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


113-113: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


115-115: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


115-115: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


117-117: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


120-120: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (13)
generator-prisma-client/aws-lambda-sst-esbuild/tsconfig.json (1)

1-12: LGTM! TypeScript configuration aligns with ESM requirements.

The configuration properly targets ESNext with Bundler module resolution, which is consistent with the ESM setup described in the README and package.json. The strict type checking and Node.js types are appropriate for this AWS Lambda project.

generator-prisma-client/aws-lambda-sst-esbuild/.gitignore (1)

1-39: Comprehensive .gitignore with proper artifact exclusions.

The .gitignore properly excludes build artifacts (dist/, lambda.zip), generated Prisma code (src/generated/), and SST artifacts (.sst). The selective inclusion of VS Code configuration files is a good practice for team development.

generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts (2)

1-5: Standard SST auto-generated file header.

The header correctly indicates this is an auto-generated file with appropriate linter suppressions.


6-18: Type-safe SST resource definitions.

The module augmentation properly extends the SST Resource interface with the expected resources:

  • DIRECT_URL: Secret for database connection string
  • aws-lambda: Function resource with URL endpoint

This enables type-safe access to these resources throughout the application.

generator-prisma-client/aws-lambda-sst-esbuild/prisma/schema.prisma (3)

5-10: LGTM! Generator configuration is properly set up.

The Prisma client generator is correctly configured with:

  • ESM module format for compatibility with the project setup
  • Driver adapters and query compiler preview features
  • Output path aligned with the project structure

12-16: LGTM! Datasource configuration follows best practices.

The PostgreSQL datasource correctly uses separate connection strings for migrations (DATABASE_URL) and direct connections (DIRECT_URL), which is the recommended approach for Prisma Postgres with connection pooling.


18-21: LGTM! Simple and well-structured data model.

The QuoteKind enum and Quotes model are appropriately designed for the example application. The use of auto-incrementing IDs, default values, and timestamps follows Prisma best practices.

Also applies to: 23-28

generator-prisma-client/aws-lambda-sst-esbuild/prisma.config.ts (1)

1-6: Prisma config setup looks good.

Schema path and defineConfig usage are correct for Prisma’s TS config. No issues spotted.

generator-prisma-client/aws-lambda-sst-esbuild/src/prisma-enums.ts (1)

1-1: LGTM: clean re-export for generated enums.

This provides a stable import surface for enums across the codebase and seed scripts.

generator-prisma-client/aws-lambda-sst-esbuild/prisma/seed.ts (1)

1-3: Verify how this script is executed so Resource.DIRECT_URL is available.

Since prisma is imported from ../src/db (which reads Resource.DIRECT_URL), ensure seed runs via SST so the secret is bound (e.g., “sst bind pnpm prisma db seed” or equivalent). Running “prisma db seed” directly without binding will likely fail.

If you rely on SST binding, consider documenting the seed command in README to avoid confusion.

generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (1)

1-4: PrismaPg supports PoolConfig objects directly – no fallback needed

Your current use of

const adapter = new PrismaPg({ connectionString })

is valid as of Prisma v6.x (June 2025+). The PrismaPg constructor accepts a PoolConfig object (e.g. { connectionString }), a connection string, or an existing pg.Pool/pg.Client. You can safely remove any manual new Pool(...) fallback.

generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts (1)

24-25: Public Function URL by default; confirm this is intended.

url: true typically produces a public Function URL. If this endpoint fronts a DB-backed handler, consider requiring IAM auth or restricting CORS.

If you intend to restrict access, update to an authenticated URL variant (example API, exact options depend on your SST version):

// Example only; adjust to the proper property supported by your SST version.
url: { auth: "iam" }
generator-prisma-client/aws-lambda-sst-esbuild/package.json (1)

19-23: Add missing pg dependency & remove duplicated sst entry

@prisma/adapter-pg requires the pg driver at runtime (otherwise you’ll see “Cannot find module 'pg'”). Also, sst is already listed in devDependencies and shouldn’t be a runtime dependency.

– File: generator-prisma-client/aws-lambda-sst-esbuild/package.json
– Section: dependencies

   "dependencies": {
     "@prisma/adapter-pg": "6.15.0-integration-fix-prisma-client-dirname-aws-lambda.3",
     "@prisma/client": "6.15.0-integration-fix-prisma-client-dirname-aws-lambda.3",
-    "sst": "3.17.10",
+    "pg": "^8.12.0"
   },

Please verify the exact pg version required by your lockfile or the Prisma adapter docs and adjust the version range if needed.

Copy link

@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: 2

♻️ Duplicate comments (6)
generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts (1)

19-19: Remove redundant self-reference; it can cause circular resolution.

This triple-slash directive references the file itself and is unnecessary. Also, this file is marked as auto-generated; ensure the generator doesn’t re-add it.

-/// <reference path="sst-env.d.ts" />
generator-prisma-client/aws-lambda-sst-esbuild/package.json (2)

4-8: Run prisma generate before bundling to ensure client/engine availability.

Add a prebuild step so the Prisma client exists before any bundling or deploy.

   "scripts": {
+    "prebuild": "prisma generate",
-    "build": "esbuild --bundle --outfile=./dist/index.js --format=esm --platform=node --target=node20 ./src/index.ts",
+    "build": "esbuild --bundle --outfile=./dist/index.js --format=esm --platform=node --target=node20 ./src/index.ts",
     "deploy": "sst deploy",
     "zip": "zip -j dist/lambda.zip dist/index.js"
   },

4-8: Avoid a split deploy story; either rely on SST packaging or make the manual path complete.

Right now deploy uses sst deploy, but you also keep a zip script that’s not used by SST and would produce an incomplete artifact (no node_modules/Prisma engine). Either:

  • A) Remove build/zip and rely solely on sst deploy, or
  • B) Keep the manual flow and externalize Prisma deps, then zip node_modules and the engine correctly.

Option A (recommended):

   "scripts": {
-    "prebuild": "prisma generate",
-    "build": "esbuild --bundle --outfile=./dist/index.js --format=esm --platform=node --target=node20 ./src/index.ts",
-    "deploy": "sst deploy",
-    "zip": "zip -j dist/lambda.zip dist/index.js"
+    "prebuild": "prisma generate",
+    "deploy": "sst deploy"
   },

Option B (manual flow – if you must keep it):

   "scripts": {
     "prebuild": "prisma generate",
-    "build": "esbuild --bundle --outfile=./dist/index.js --format=esm --platform=node --target=node20 ./src/index.ts",
+    "build": "esbuild --bundle --outfile=./dist/index.js --format=esm --platform=node --target=node20 --external:@prisma/client --external:@prisma/adapter-pg --external:pg ./src/index.ts",
-    "deploy": "sst deploy",
-    "zip": "zip -j dist/lambda.zip dist/index.js"
+    "zip": "zip -r dist/lambda.zip dist/index.js node_modules/@prisma/client node_modules/.prisma/client node_modules/pg"
   },
generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (1)

1-5: Add an explicit return type for the Lambda handler.

Improves type-safety and prevents accidental shape drift.

-import { APIGatewayProxyEventV2 } from 'aws-lambda';
+import { APIGatewayProxyEventV2, APIGatewayProxyStructuredResultV2 } from 'aws-lambda';
 
-export const handler = async (evt: APIGatewayProxyEventV2) => {
+export const handler = async (evt: APIGatewayProxyEventV2): Promise<APIGatewayProxyStructuredResultV2> => {
generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts (2)

17-19: Do not inline secret values; set them out-of-band.

Create the Secret without a literal value and set it via sst secrets set (or your secret manager). Avoid committing placeholders that look like secrets.

-    const secrets = {
-      directUrl: new sst.Secret("DIRECT_URL", '<placeholder_value>'),
-    }
+    const secrets = {
+      // Set at deploy/runtime: `pnpm sst secrets set DIRECT_URL=<connection-string>`
+      directUrl: new sst.Secret("DIRECT_URL"),
+    }

22-32: Optional: give the Lambda a stable AWS name (useful for monitoring/integrations).

If you need a predictable physical name, set it here; otherwise, SST’s generated name is fine.

-    new sst.aws.Function('prisma-client-aws-lambda-sst', {
+    new sst.aws.Function('prisma-client-aws-lambda-sst', {
+      name: `${$app.name}-${$app.stage}-prisma-client-aws-lambda-sst`,
       handler: "src/index.handler",
       url: true,
       runtime: 'nodejs20.x',
       architecture: 'arm64',
       link: [
         // encrypts the secrets as part of the function bundle on deploy, and
         // then synchronously decrypts them as the function loads via the SST SDK.
         ...allSecrets,
       ],
     })

If the build complains about the property, confirm you’re on sst.aws.Function (v3) where name is valid.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8377df8 and e629013.

📒 Files selected for processing (4)
  • generator-prisma-client/aws-lambda-sst-esbuild/package.json (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-08-22T13:15:07.917Z
Learnt from: jkomyno
PR: prisma/prisma-examples#8284
File: generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts:22-32
Timestamp: 2025-08-22T13:15:07.917Z
Learning: In SST v3, for sst.aws.Function, the correct property to set the AWS Lambda function name is `name`, not `functionName`. The `functionName` property was used in the legacy sst.Function construct from SST v2. The recommended pattern is to include app and stage: `name: \`${$app.name}-${$app.stage}-function-name\``.

Applied to files:

  • generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts
📚 Learning: 2025-08-22T13:15:07.917Z
Learnt from: jkomyno
PR: prisma/prisma-examples#8284
File: generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts:22-32
Timestamp: 2025-08-22T13:15:07.917Z
Learning: In SST 3, the `name` property is deprecated for sst.aws.Function. Use `functionName` instead to set the AWS Lambda function name.

Applied to files:

  • generator-prisma-client/aws-lambda-sst-esbuild/sst.config.ts
📚 Learning: 2025-08-22T12:12:24.563Z
Learnt from: FGoessler
PR: prisma/prisma-examples#8260
File: generator-prisma-client/nextjs-starter-webpack-turborepo/packages/database/package.json:13-13
Timestamp: 2025-08-22T12:12:24.563Z
Learning: When analyzing changes from package.json seed scripts to "prisma db seed", always verify the actual content of prisma.config.ts rather than relying solely on regex patterns, as the configuration may be properly defined but in a format that doesn't match overly restrictive search patterns.

Applied to files:

  • generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts
  • generator-prisma-client/aws-lambda-sst-esbuild/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
  • GitHub Check: test (orm/astro)
  • GitHub Check: test (orm/ai-sdk-nextjs)
  • GitHub Check: test (orm/graphql)
  • GitHub Check: test (orm/graphql-sdl-first)
  • GitHub Check: test (orm/fastify)
  • GitHub Check: test (orm/clerk-nextjs)
  • GitHub Check: test (orm/fastify-graphql)
  • GitHub Check: test (orm/hapi)
  • GitHub Check: test (orm/authjs-nextjs)
  • GitHub Check: test (orm/betterauth-nextjs)
  • GitHub Check: test (orm/graphql-auth)
  • GitHub Check: test (orm/graphql-subscriptions)
  • GitHub Check: test (orm/express)
  • GitHub Check: test (orm/graphql-nexus)
  • GitHub Check: test (orm/fastify-graphql-sdl-first)
  • GitHub Check: test (orm/nuxt)
  • GitHub Check: test (orm/koa)
  • GitHub Check: test (orm/grpc)
  • GitHub Check: test (orm/nest)
  • GitHub Check: test (orm/nest-graphql)
  • GitHub Check: test (orm/hapi-graphql)
  • GitHub Check: test (orm/hapi-graphql-sdl-first)
  • GitHub Check: test (orm/nest-graphql-sdl-first)
  • GitHub Check: test (orm/testing-express)
  • GitHub Check: test (orm/nextjs)
  • GitHub Check: test (orm/react-router-7)
  • GitHub Check: test (orm/nextjs-graphql)
  • GitHub Check: test (orm/sveltekit)
  • GitHub Check: test (orm/solid-start)
🔇 Additional comments (2)
generator-prisma-client/aws-lambda-sst-esbuild/package.json (1)

17-21: sst is imported at runtime—no changes needed

  • Detected a runtime import of Resource from "sst" in
    generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (line 2).
  • Since sst is used in your Lambda handler code at runtime, it belongs in dependencies.
generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (1)

18-20: Prisma client property is correct
I’ve confirmed that your schema at generator-prisma-client/aws-lambda-sst-esbuild/prisma/schema.prisma defines model Quotes (line 23), which maps to prisma.quotes in the generated client. No changes are needed.

FGoessler
FGoessler previously approved these changes Aug 22, 2025
Copy link

@FGoessler FGoessler left a comment

Choose a reason for hiding this comment

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

Approved but please check the code rabbit comments on the readme regarding esm vs cjs and nextjs!

Copy link

@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: 14

♻️ Duplicate comments (14)
generator-prisma-client/aws-lambda-sst-esbuild/README.md (5)

3-3: Fix ESM/CJS statement and article usage.

The intro contradicts the ESM setup and has a minor grammar issue.

-This project showcases how to use the Prisma ORM with Prisma Postgres in an TypeScript application transpiled to CommonJS (CJS) using ESBuild.
+This project showcases how to use the Prisma ORM with Prisma Postgres in a TypeScript application compiled to ES modules (ESM) using esbuild.

16-21: Correct the tech stack: this is AWS Lambda + SST, not Next.js.

-## Tech Stack
-
-- Next.js 15
+## Tech Stack
+
+- AWS Lambda with SST
   - Runtime: Node.js 20.19.0
   - Bundler: esbuild
   - `package.json` contains `{ "type": "module" }`
   - `esbuild` specifies `--format=esm`, `--platform=node`, and `--target=node20`
 - Prisma Client with the `prisma-client` generator
   See the [Prisma schema file](./prisma/schema.prisma) for details.

44-48: Add language to fenced code blocks for readability and tooling.

-```
+```bash
 git clone git@github.com:prisma/prisma-examples.git --depth=1
 cd prisma-examples/generator-prisma-client/aws-lambda-sst-esbuild
 pnpm install

Repeat the same for the blocks at Lines 80–82, 86–88, 94–96, and 102–104 (use bash).


Also applies to: 80-82, 86-88, 94-96, 102-104

---

`111-117`: **Surround code fences with blank lines and specify language.**



```diff
-  - Manually adding the `DIRECT_URL` connection string that you previously set in your `.env` file, via:
-  ```
-  pnpm sst secrets add DIRECT_URL __YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__
-  ```
-  - Or, by loading the `.env` file first and piping it to the `sst secrets add` command:
-  ```
-  pnpm dotenv -- bash -c 'pnpm sst secret set DIRECT_URL "${DIRECT_URL}"'
-  ```
+  - Manually adding the `DIRECT_URL` connection string that you previously set in your `.env` file, via:
+
+  ```bash
+  pnpm sst secrets add DIRECT_URL __YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__
+  ```
+
+  - Or, by loading the `.env` file first and piping it to the `sst secrets add` command:
+
+  ```bash
+  pnpm dotenv -- bash -c 'pnpm sst secret set DIRECT_URL "${DIRECT_URL}"'
+  ```
@@
-  ```
-  pnpm sst deploy
-  ```
+  ```bash
+  pnpm sst deploy
+  ```

Also applies to: 120-122


69-69: Remove irrelevant NEXT_PUBLIC_URL.

This var is Next.js-specific and not used in this Lambda/SST example.

-NEXT_PUBLIC_URL="http://localhost:3000"
generator-prisma-client/aws-lambda-sst-esbuild/package.json (4)

5-5: Externalize Prisma and pg from the esbuild bundle to preserve the native engine.

-    "build": "esbuild --bundle --outfile=./dist/index.js --format=esm --platform=node --target=node20 ./src/index.ts",
+    "build": "esbuild --bundle --outfile=./dist/index.js --format=esm --platform=node --target=node20 --external:@prisma/client --external:@prisma/adapter-pg --external:pg ./src/index.ts",

4-8: Generate Prisma Client before bundling.

   "scripts": {
+    "prebuild": "prisma generate",
     "build": "esbuild --bundle --outfile=./dist/index.js --format=esm --platform=node --target=node20 ./src/index.ts",
     "deploy": "sst deploy",
-    "zip": "zip -j dist/lambda.zip dist/index.js"
+    "zip": "zip -j dist/lambda.zip dist/index.js"
   },

15-15: Plan a follow-up to switch from integration pins to the next stable Prisma release.

Keep the integration build for this PR; once upstream lands, update:

  • prisma
  • @prisma/adapter-pg
  • @prisma/client

I can help script the update across package.json and the lockfile when ready.

Also applies to: 19-20


7-8: Remove unused zip script or wire it into a manual deploy flow.

It’s not referenced by any other script and risks drifting from the SST flow.

-    "deploy": "sst deploy",
-    "zip": "zip -j dist/lambda.zip dist/index.js"
+    "deploy": "sst deploy"
generator-prisma-client/aws-lambda-sst-esbuild/prisma/seed.ts (2)

10-14: Make reset+seed atomic with a single transaction.

-  await prisma.quotes.deleteMany()
-
-  await prisma.quotes.createMany({
-    skipDuplicates: true,
-    data: [
+  await prisma.$transaction([
+    prisma.quotes.deleteMany(),
+    prisma.quotes.createMany({
+      skipDuplicates: true,
+      data: [
         // …unchanged rows…
-    ],
-  })
+      ],
+    }),
+  ])

Also applies to: 12-141


146-150: Disconnect Prisma and set non-zero exit code on failure to avoid hanging processes.

 main()
   .then(() => {
     console.log('Process completed')
   })
-  .catch((e) => console.log(e))
+  .catch((e) => {
+    console.error(e)
+    process.exitCode = 1
+  })
+  .finally(async () => {
+    await prisma.$disconnect()
+  })
generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (1)

10-15: Add return type, validate input, and simplify naming.

-export function getDb({ connectionString }: GetDbParams) {
-  const pool = new PrismaPg({ connectionString })
-  const prisma = new PrismaClient({ adapter: pool })
-
-  return prisma
-}
+export function getDb({ connectionString }: GetDbParams): PrismaClient {
+  if (!connectionString) {
+    throw new Error('Missing connection string for Prisma')
+  }
+  const adapter = new PrismaPg({ connectionString })
+  return new PrismaClient({ adapter })
+}
generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (2)

5-5: PrismaClient reuse across warm invocations looks good.

Top-level initialization reuses the client between Lambda invocations in the same execution environment, avoiding connection churn. This addresses the earlier concern.


1-1: Add explicit Lambda result type (APIGatewayProxyStructuredResultV2).

The handler currently relies on inference. Add an explicit return type and import to lock the response shape and prevent accidental drift. This also aligns with prior feedback.

Apply this diff:

-import { APIGatewayProxyEventV2 } from 'aws-lambda';
+import { APIGatewayProxyEventV2, APIGatewayProxyStructuredResultV2 } from 'aws-lambda';
@@
-export const handler = async (evt: APIGatewayProxyEventV2) => {
+export const handler = async (
+  evt: APIGatewayProxyEventV2,
+): Promise<APIGatewayProxyStructuredResultV2> => {

Also applies to: 7-7

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e629013 and 86aefe9.

⛔ Files ignored due to path filters (1)
  • generator-prisma-client/aws-lambda-sst-esbuild/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • generator-prisma-client/aws-lambda-sst-esbuild/README.md (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/package.json (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/prisma.config.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/prisma/seed.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-22T12:12:24.563Z
Learnt from: FGoessler
PR: prisma/prisma-examples#8260
File: generator-prisma-client/nextjs-starter-webpack-turborepo/packages/database/package.json:13-13
Timestamp: 2025-08-22T12:12:24.563Z
Learning: When analyzing changes from package.json seed scripts to "prisma db seed", always verify the actual content of prisma.config.ts rather than relying solely on regex patterns, as the configuration may be properly defined but in a format that doesn't match overly restrictive search patterns.

Applied to files:

  • generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts
  • generator-prisma-client/aws-lambda-sst-esbuild/prisma.config.ts
  • generator-prisma-client/aws-lambda-sst-esbuild/package.json
  • generator-prisma-client/aws-lambda-sst-esbuild/prisma/seed.ts
  • generator-prisma-client/aws-lambda-sst-esbuild/README.md
🧬 Code graph analysis (2)
generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (2)
generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (1)
  • getDb (10-15)
generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts (1)
  • Resource (7-17)
generator-prisma-client/aws-lambda-sst-esbuild/prisma/seed.ts (1)
generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (1)
  • getDb (10-15)
🪛 LanguageTool
generator-prisma-client/aws-lambda-sst-esbuild/README.md

[grammar] ~1-~1: Use correct spacing
Context: ...S Lambda + SST + ESBuild + Node.js + ESM This project showcases how to use the Pr...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~3-~3: Use articles correctly
Context: ... the Prisma ORM with Prisma Postgres in an TypeScript application transpiled to Co...

(QB_NEW_EN_OTHER_ERROR_IDS_11)


[grammar] ~3-~3: Use correct spacing
Context: ...nspiled to CommonJS (CJS) using ESBuild. ## Prerequisites To successfully run the p...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~5-~5: Use correct spacing
Context: ...S (CJS) using ESBuild. ## Prerequisites To successfully run the project, you wil...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~7-~7: Use correct spacing
Context: ...he project, you will need the following: - Two Prisma Postgres connection strin...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~10-~10: There might be a mistake here.
Context: ...ring** (containing your Prisma API key) which you can get by enabling Postgres ...

(QB_NEW_EN_OTHER)


[grammar] ~11-~11: There might be a mistake here.
Context: ...ma Postgres direct TCP connection string** which you will use with Prisma Client. ...

(QB_NEW_EN_OTHER)


[grammar] ~11-~11: There might be a problem here.
Context: ...* which you will use with Prisma Client. Learn more in the [docs](https://www.pr...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~12-~12: Use correct spacing
Context: ...s/postgres/database/direct-connections). ## Tech Stack - Next.js 15 - Runtime: No...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~14-~14: Use correct spacing
Context: ...base/direct-connections). ## Tech Stack - Next.js 15 - Runtime: Node.js 20.19.0 ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~16-~16: There might be a mistake here.
Context: ...nnections). ## Tech Stack - Next.js 15 - Runtime: Node.js 20.19.0 - Bundler: es...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ... Next.js 15 - Runtime: Node.js 20.19.0 - Bundler: esbuild - package.json cont...

(QB_NEW_EN)


[grammar] ~18-~18: Use correct spacing
Context: ...me: Node.js 20.19.0 - Bundler: esbuild - package.json contains { "type": "module" } - `esb...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~19-~19: Use correct spacing
Context: ...er: esbuild - package.json contains { "type": "module" } - esbuild specifies --format=esm, `--platform=n...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~20-~20: Use correct spacing
Context: ... --format=esm, --platform=node, and --target=node20 - Prisma Client with the prisma-client g...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~21-~21: There might be a mistake here.
Context: ...lient with the prisma-client generator See the [Prisma schema file](./prisma/sc...

(QB_NEW_EN_OTHER)


[grammar] ~22-~22: Use correct spacing
Context: ...le](./prisma/schema.prisma) for details. prisma generator client { provider = "prisma-client" output = "../src/generated/prisma" previewFeatures = ["driverAdapters", "queryCompiler"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") directUrl = env("DIRECT_URL") } ## Getting started ### 1. Clone the reposi...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~38-~38: Use correct spacing
Context: ...RECT_URL") } ``` ## Getting started ### 1. Clone the repository Clone the repos...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~40-~40: There might be a mistake here.
Context: ...ing started ### 1. Clone the repository Clone the repository, navigate into it a...

(QB_NEW_EN_OTHER)


[grammar] ~42-~42: There might be a mistake here.
Context: ...ry Clone the repository, navigate into it and install dependencies: ``` git clon...

(QB_NEW_EN_OTHER)


[grammar] ~42-~42: Use correct spacing
Context: ...vigate into it and install dependencies: git clone git@github.com:prisma/prisma-examples.git --depth=1 cd prisma-examples/generator-prisma-client/aws-lambda-sst-esbuild pnpm install ### 2. Configure environment variables Crea...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~50-~50: There might be a mistake here.
Context: ... ### 2. Configure environment variables Create a .env in the root of the proje...

(QB_NEW_EN_OTHER)


[grammar] ~52-~52: Use correct spacing
Context: ...vin the root of the project directory: ```bash touch .env ``` Now, open the.envfile and set theD...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~58-~58: Use correct spacing
Context: ... your Prisma Postgres connection string: bash # .env # Prisma Postgres connection string (used for migrations) DATABASE_URL="__YOUR_PRISMA_POSTGRES_CONNECTION_STRING__" # Postgres connection string (used for queries by Prisma Client) DIRECT_URL="__YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__" NEXT_PUBLIC_URL="http://localhost:3000" Note that `__YOUR_PRISMA_POSTGRES_CONNEC...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~72-~72: Use correct spacing
Context: ...isma-data.net/?api_key=<api_key_value>. Note that __YOUR_PRISMA_POSTGRES_DIRECT...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~74-~74: Use correct spacing
Context: ...e>:@:/`. ### 3. Run a migration to create the databas...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~76-~76: There might be a mistake here.
Context: ...database structure and seed the database The [Prisma schema file](./prisma/schema...

(QB_NEW_EN_OTHER)


[grammar] ~78-~78: Use correct spacing
Context: ...otestable using the following command: ``` pnpm prisma migrate dev --name init ``` You now have an emptyQuotes` table in ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~84-~84: Use correct spacing
Context: ...create some sample records in the table: pnpm prisma db seed ### 4. Generate Prisma Client Run: ``` pnp...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~90-~90: Use correct spacing
Context: ... seed ### 4. Generate Prisma Client Run: pnpm prisma generate ``` ### ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~92-~92: Use correct spacing
Context: ... ### 4. Generate Prisma Client Run: pnpm prisma generate ### 5. Bundle the project Run pnpm run...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~98-~98: There might be a mistake here.
Context: ... generate ### 5. Bundle the project Run pnpm run build ``` ### 6. Run ...

(QB_NEW_EN_OTHER)


[grammar] ~100-~100: Use correct spacing
Context: ...rate ### 5. Bundle the project Run pnpm run build ``` ### 6. Run with SST - Ensure you set up you...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~106-~106: Use proper capitalization
Context: ... pnpm run build ``` ### 6. Run with SST - Ensure you set up your AWS Credentials a...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~108-~108: There might be a mistake here.
Context: ...ocs](https://sst.dev/docs/aws-accounts)) - Set up secrets in your SST project. You ...

(QB_NEW_EN_OTHER)


[grammar] ~109-~109: There might be a mistake here.
Context: ...ts in your SST project. You can do this by: - Manually adding the DIRECT_URL connection stri...

(QB_NEW_EN_OTHER)


[grammar] ~110-~110: There might be a problem here.
Context: ...t you previously set in your .env file, via: pnpm sst secrets add DIRECT_URL __YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__ - Or, by loading the .env file first and...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~114-~114: Use correct spacing
Context: ...ing it to the sst secrets add command: pnpm dotenv -- bash -c 'pnpm sst secret set DIRECT_URL "${DIRECT_URL}"' - Run the following command to deploy the ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~124-~124: Use correct spacing
Context: ...ou should see an output similar to this: sh ❯ pnpm sst deploy SST 3.17.10 ready! ➜ App: prisma-client-aws-lambda-sst Stage: prisma ~ Deploy | Created aws-lambda sst:aws:Function → aws-lambdaCode aws:s3:BucketObjectv2 (2.3s) | Created aws-lambda sst:aws:Function → aws-lambdaSourcemap0 aws:s3:BucketObjectv2 (6.1s) | Updated aws-lambda sst:aws:Function → aws-lambdaFunction aws:lambda:Function (12.7s) | Deleted aws-lambda sst:aws:Function → aws-lambdaCode aws:s3:BucketObjectv2 ↗ Permalink https://sst.dev/u/<...> ✓ Complete prisma-client-aws-lambda-sst: https://<...>.lambda-url.us-east-1.on.aws/ ## Resources - [Prisma Postgres documentat...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~146-~146: Use correct spacing
Context: ...-url.us-east-1.on.aws/ ``` ## Resources - [Prisma Postgres documentation](https://w...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~148-~148: There might be a mistake here.
Context: ...ources - Prisma Postgres documentation - Check out the [Prisma docs](https://www....

(QB_NEW_EN)


[grammar] ~150-~150: There might be a mistake here.
Context: ... feedback and interact with other users. - [Subscribe to our YouTube channel](https:...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
generator-prisma-client/aws-lambda-sst-esbuild/README.md

44-44: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


80-80: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


86-86: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


94-94: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


102-102: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


111-111: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


111-111: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


113-113: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


115-115: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


115-115: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


117-117: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


120-120: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
  • GitHub Check: test (orm/betterauth-nextjs)
  • GitHub Check: test (orm/fastify)
  • GitHub Check: test (orm/ai-sdk-nextjs)
  • GitHub Check: test (orm/astro)
  • GitHub Check: test (orm/authjs-nextjs)
  • GitHub Check: test (orm/graphql)
  • GitHub Check: test (orm/express)
  • GitHub Check: test (orm/graphql-auth)
  • GitHub Check: test (orm/nest-graphql-sdl-first)
  • GitHub Check: test (orm/hapi)
  • GitHub Check: test (orm/fastify-graphql-sdl-first)
  • GitHub Check: test (orm/graphql-nexus)
  • GitHub Check: test (orm/graphql-subscriptions)
  • GitHub Check: test (orm/clerk-nextjs)
  • GitHub Check: test (orm/fastify-graphql)
  • GitHub Check: test (orm/hapi-graphql)
  • GitHub Check: test (orm/graphql-sdl-first)
  • GitHub Check: test (orm/hapi-graphql-sdl-first)
  • GitHub Check: test (orm/nextjs-graphql)
  • GitHub Check: test (orm/react-router-7)
  • GitHub Check: test (orm/nest-graphql)
  • GitHub Check: test (orm/grpc)
  • GitHub Check: test (orm/nest)
  • GitHub Check: test (orm/koa)
  • GitHub Check: test (orm/nuxt)
  • GitHub Check: test (orm/nextjs)
  • GitHub Check: test (orm/sveltekit)
  • GitHub Check: test (orm/solid-start)
🔇 Additional comments (1)
generator-prisma-client/aws-lambda-sst-esbuild/prisma.config.ts (1)

1-9: Config LGTM; seed is wired via defineConfig.

Schema path and migrations.seed integrate correctly with the project layout. TSX is present in devDeps. Also validated per our prior learning to inspect prisma.config.ts directly for seed wiring.

nurul3101
nurul3101 previously approved these changes Aug 22, 2025
@nurul3101 nurul3101 merged commit 236acc7 into latest Aug 22, 2025
42 of 44 checks passed
@nurul3101 nurul3101 deleted the feat/prisma-client-aws-lambda-sst branch August 22, 2025 15:00
Copy link

@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: 4

♻️ Duplicate comments (5)
generator-prisma-client/aws-lambda-sst-esbuild/README.md (4)

57-57: Clarify that both DATABASE_URL and DIRECT_URL must be set.

The current sentence uses plural “environment variables” but only names one. Make the requirement explicit.

-Now, open the `.env` file and set the `DATABASE_URL` environment variables with the values of your connection string and your Prisma Postgres connection string:
+Now, open the `.env` file and set the `DATABASE_URL` and `DIRECT_URL` environment variables using your Prisma Postgres connection strings:

43-47: Add language to shell block.

Improves syntax highlighting and satisfies markdownlint MD040.

-```
+```bash
 git clone git@github.com:prisma/prisma-examples.git --depth=1
 cd prisma-examples/generator-prisma-client/aws-lambda-sst-esbuild
 pnpm install

---

`77-79`: **Specify languages and surround code fences with blank lines.**

Multiple fenced blocks are missing language tags, and some are not separated by blank lines inside lists (MD040/MD031). Apply consistently.


```diff
-```
+```bash
 pnpm prisma migrate dev --name init

- +bash
pnpm prisma db seed


-```
+```bash
pnpm prisma generate

@@

  • pnpm sst deploy
  • pnpm sst deploy

@@
- -pnpm build -du -sh ./dist/index.js -
+bash +pnpm build +du -sh ./dist/index.js +
@@
- -pnpm zip -du -sh ./dist/lambda.zip -
+bash +pnpm zip +du -sh ./dist/lambda.zip +
@@
- +sh
❯ du -sh ./dist/index.js
3.0M ./dist/index.js

❯ du -sh ./dist/lambda.zip
1.1M ./dist/lambda.zip

Also applies to: 83-85, 91-93, 109-111, 139-142, 146-149, 153-159


98-106: Unify SST CLI to v3 “secret set” (singular) and fix code fence formatting.

SST v3 uses the singular command sst secret set .... The README currently mixes secrets add and secret set. Also add language tags and blank lines for proper rendering. See SST CLI docs. (sst.dev)

 - Set up secrets in your SST project. You can do this by:
   - Manually adding the `DIRECT_URL` connection string that you previously set in your `.env` file, via:
-  ```
-  pnpm sst secrets add DIRECT_URL __YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__
-  ```
+  
+  ```bash
+  pnpm sst secret set DIRECT_URL __YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__
+  ```
   - Or, by loading the `.env` file first and piping it to the `sst secrets add` command:
-  ```
-  pnpm dotenv -- bash -c 'pnpm sst secret set DIRECT_URL "${DIRECT_URL}"'
-  ```
+  
+  ```bash
+  pnpm dotenv -- bash -c 'pnpm sst secret set DIRECT_URL "${DIRECT_URL}"'
+  ```
generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (1)

22-22: Deterministic results: add orderBy to findMany.

Without ordering, the two rows returned can vary run-to-run. Order by a stable key like id or createdAt.

-    const quotes = await prisma.quotes.findMany({ take: 2 })
+    const quotes = await prisma.quotes.findMany({
+      take: 2,
+      orderBy: { id: 'desc' }, // or createdAt: 'desc'
+    })
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 86aefe9 and 383ffc5.

📒 Files selected for processing (2)
  • generator-prisma-client/aws-lambda-sst-esbuild/README.md (1 hunks)
  • generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-22T12:12:24.563Z
Learnt from: FGoessler
PR: prisma/prisma-examples#8260
File: generator-prisma-client/nextjs-starter-webpack-turborepo/packages/database/package.json:13-13
Timestamp: 2025-08-22T12:12:24.563Z
Learning: When analyzing changes from package.json seed scripts to "prisma db seed", always verify the actual content of prisma.config.ts rather than relying solely on regex patterns, as the configuration may be properly defined but in a format that doesn't match overly restrictive search patterns.

Applied to files:

  • generator-prisma-client/aws-lambda-sst-esbuild/README.md
  • generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts
🧬 Code graph analysis (1)
generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (2)
generator-prisma-client/aws-lambda-sst-esbuild/src/db.ts (1)
  • getDb (10-15)
generator-prisma-client/aws-lambda-sst-esbuild/sst-env.d.ts (1)
  • Resource (7-17)
🪛 LanguageTool
generator-prisma-client/aws-lambda-sst-esbuild/README.md

[grammar] ~1-~1: Use correct spacing
Context: ...xample: AWS Lambda + SST + Node.js + ESM This project showcases how to use the Pr...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~3-~3: Use articles correctly
Context: ... with AWS Lambda and Prisma Postgres in an TypeScript ESM application. ## Prerequ...

(QB_NEW_EN_OTHER_ERROR_IDS_11)


[grammar] ~3-~3: Use correct spacing
Context: ...stgres in an TypeScript ESM application. ## Prerequisites To successfully run the p...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~5-~5: Use correct spacing
Context: ...cript ESM application. ## Prerequisites To successfully run the project, you wil...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~7-~7: Use correct spacing
Context: ...he project, you will need the following: - Two Prisma Postgres connection strin...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~9-~9: There might be a mistake here.
Context: ... Prisma Postgres connection strings: - Your **Prisma Postgres + Accelerate conn...

(QB_NEW_EN)


[grammar] ~10-~10: There might be a mistake here.
Context: ...ring** (containing your Prisma API key) which you can get by enabling Postgres ...

(QB_NEW_EN_OTHER)


[grammar] ~11-~11: There might be a mistake here.
Context: ...ma Postgres direct TCP connection string** which you will use with Prisma Client. ...

(QB_NEW_EN_OTHER)


[grammar] ~11-~11: There might be a problem here.
Context: ...* which you will use with Prisma Client. Learn more in the [docs](https://www.pr...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~12-~12: Use correct spacing
Context: ...s/postgres/database/direct-connections). ## Tech Stack - SST 3 + AWS Lambda - Run...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~14-~14: Use correct spacing
Context: ...base/direct-connections). ## Tech Stack - SST 3 + AWS Lambda - Runtime: Nodejs 2...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~16-~16: There might be a mistake here.
Context: ...s). ## Tech Stack - SST 3 + AWS Lambda - Runtime: Nodejs 20.x - Bundler: esbuil...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ...tack - SST 3 + AWS Lambda - Runtime: Nodejs 20.x - Bundler: esbuild (used via SST...

(QB_NEW_EN_OTHER)


[grammar] ~17-~17: There might be a mistake here.
Context: ... 3 + AWS Lambda - Runtime: Nodejs 20.x - Bundler: esbuild (used via SST) - `pac...

(QB_NEW_EN)


[grammar] ~20-~20: There might be a mistake here.
Context: ...lient with the prisma-client generator See the [Prisma schema file](./prisma/sc...

(QB_NEW_EN_OTHER)


[grammar] ~21-~21: Use correct spacing
Context: ...le](./prisma/schema.prisma) for details. prisma generator client { provider = "prisma-client" output = "../src/generated/prisma" previewFeatures = ["driverAdapters", "queryCompiler"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") directUrl = env("DIRECT_URL") } ## Getting started ### 1. Clone the reposi...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~37-~37: Use correct spacing
Context: ...RECT_URL") } ``` ## Getting started ### 1. Clone the repository Clone the repos...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~39-~39: There might be a mistake here.
Context: ...ing started ### 1. Clone the repository Clone the repository, navigate into it a...

(QB_NEW_EN_OTHER)


[grammar] ~41-~41: There might be a mistake here.
Context: ...ry Clone the repository, navigate into it and install dependencies: ``` git clon...

(QB_NEW_EN_OTHER)


[grammar] ~41-~41: Use correct spacing
Context: ...vigate into it and install dependencies: git clone git@github.com:prisma/prisma-examples.git --depth=1 cd prisma-examples/generator-prisma-client/aws-lambda-sst-esbuild pnpm install ### 2. Configure environment variables Crea...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~49-~49: There might be a mistake here.
Context: ... ### 2. Configure environment variables Create a .env in the root of the proje...

(QB_NEW_EN_OTHER)


[grammar] ~51-~51: Use correct spacing
Context: ...vin the root of the project directory: ```bash touch .env ``` Now, open the.envfile and set theD...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~57-~57: Use correct spacing
Context: ... your Prisma Postgres connection string: bash # .env # Prisma Postgres connection string (used for migrations) DATABASE_URL="__YOUR_PRISMA_POSTGRES_CONNECTION_STRING__" # Postgres connection string (used for queries by Prisma Client) DIRECT_URL="__YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__" Note that `__YOUR_PRISMA_POSTGRES_CONNEC...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~69-~69: Use correct spacing
Context: ...isma-data.net/?api_key=<api_key_value>. Note that __YOUR_PRISMA_POSTGRES_DIRECT...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~71-~71: Use correct spacing
Context: ...e>:@:/`. ### 3. Run a migration to create the databas...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~73-~73: There might be a mistake here.
Context: ...database structure and seed the database The [Prisma schema file](./prisma/schema...

(QB_NEW_EN_OTHER)


[grammar] ~75-~75: Use correct spacing
Context: ...otestable using the following command: ``` pnpm prisma migrate dev --name init ``` You now have an emptyQuotes` table in ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~81-~81: Use correct spacing
Context: ...create some sample records in the table: pnpm prisma db seed ### 4. Generate Prisma Client Run: ``` pnp...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~87-~87: Use correct spacing
Context: ... seed ### 4. Generate Prisma Client Run: pnpm prisma generate ``` ### ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~89-~89: Use correct spacing
Context: ... ### 4. Generate Prisma Client Run: pnpm prisma generate ``` ### 5. Run with SST - Ensure you set up you...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~95-~95: Use proper capitalization
Context: ...prisma generate ``` ### 5. Run with SST - Ensure you set up your AWS Credentials a...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~97-~97: There might be a mistake here.
Context: ...ocs](https://sst.dev/docs/aws-accounts)) - Set up secrets in your SST project. You ...

(QB_NEW_EN_OTHER)


[grammar] ~98-~98: There might be a mistake here.
Context: ...ts in your SST project. You can do this by: - Manually adding the DIRECT_URL connection stri...

(QB_NEW_EN_OTHER)


[grammar] ~99-~99: There might be a problem here.
Context: ...t you previously set in your .env file, via: pnpm sst secrets add DIRECT_URL __YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__ - Or, by loading the .env file first and...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~103-~103: Use correct spacing
Context: ...ing it to the sst secrets add command: pnpm dotenv -- bash -c 'pnpm sst secret set DIRECT_URL "${DIRECT_URL}"' - Run the following command to deploy the ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~113-~113: Use correct spacing
Context: ...ou should see an output similar to this: sh ❯ pnpm sst deploy SST 3.17.10 ready! ➜ App: prisma-client-aws-lambda-sst Stage: prisma ~ Deploy | Created aws-lambda sst:aws:Function → aws-lambdaCode aws:s3:BucketObjectv2 (2.3s) | Created aws-lambda sst:aws:Function → aws-lambdaSourcemap0 aws:s3:BucketObjectv2 (6.1s) | Updated aws-lambda sst:aws:Function → aws-lambdaFunction aws:lambda:Function (12.7s) | Deleted aws-lambda sst:aws:Function → aws-lambdaCode aws:s3:BucketObjectv2 ↗ Permalink https://sst.dev/u/<...> ✓ Complete prisma-client-aws-lambda-sst: https://<...>.lambda-url.us-east-1.on.aws/ ### 6. (Optional) Verify deployment size Yo...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~135-~135: There might be a mistake here.
Context: ...### 6. (Optional) Verify deployment size You can check the size of your deploymen...

(QB_NEW_EN_OTHER)


[grammar] ~137-~137: There might be a mistake here.
Context: ... the size of your deployment package by running: pnpm build du -sh ./dist/index.js and then ``` pnpm zip du -sh ./dist/lam...

(QB_NEW_EN_OTHER)


[grammar] ~144-~144: Use correct spacing
Context: ...ild du -sh ./dist/index.js and then pnpm zip du -sh ./dist/lambda.zip The output should look similar to: ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~151-~151: Use correct spacing
Context: ... The output should look similar to: ❯ du -sh ./dist/index.js 3.0M ./dist/index.js ❯ du -sh ./dist/lambda.zip 1.1M ./dist/lambda.zip ``` ## Resources - [Prisma Postgres documentat...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~161-~161: Use correct spacing
Context: ...M ./dist/lambda.zip ``` ## Resources - [Prisma Postgres documentation](https://w...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~163-~163: There might be a mistake here.
Context: ...ources - Prisma Postgres documentation - Check out the [Prisma docs](https://www....

(QB_NEW_EN)


[grammar] ~165-~165: There might be a mistake here.
Context: ... feedback and interact with other users. - [Subscribe to our YouTube channel](https:...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
generator-prisma-client/aws-lambda-sst-esbuild/README.md

43-43: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


77-77: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


83-83: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


91-91: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


100-100: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


100-100: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


102-102: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


104-104: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


104-104: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


106-106: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


109-109: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


139-139: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


146-146: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


153-153: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (26)
  • GitHub Check: test (orm/betterauth-nextjs)
  • GitHub Check: test (orm/clerk-nextjs)
  • GitHub Check: test (orm/ai-sdk-nextjs)
  • GitHub Check: test (orm/authjs-nextjs)
  • GitHub Check: test (orm/graphql)
  • GitHub Check: test (orm/graphql-nexus)
  • GitHub Check: test (orm/astro)
  • GitHub Check: test (orm/nest-graphql-sdl-first)
  • GitHub Check: test (orm/koa)
  • GitHub Check: test (orm/express)
  • GitHub Check: test (orm/fastify)
  • GitHub Check: test (orm/fastify-graphql-sdl-first)
  • GitHub Check: test (orm/fastify-graphql)
  • GitHub Check: test (orm/hapi)
  • GitHub Check: test (orm/graphql-auth)
  • GitHub Check: test (orm/grpc)
  • GitHub Check: test (orm/hapi-graphql)
  • GitHub Check: test (orm/hapi-graphql-sdl-first)
  • GitHub Check: test (orm/graphql-sdl-first)
  • GitHub Check: test (orm/nextjs)
  • GitHub Check: test (orm/nuxt)
  • GitHub Check: test (orm/nest-graphql)
  • GitHub Check: test (orm/sveltekit)
  • GitHub Check: test (orm/react-router-7)
  • GitHub Check: test (orm/solid-start)
  • GitHub Check: test (orm/nextjs-graphql)
🔇 Additional comments (3)
generator-prisma-client/aws-lambda-sst-esbuild/README.md (2)

95-106: Nice: removed the redundant manual “bundle” step.

SST bundles from your TS entrypoint; keeping only the SST deploy section avoids drift between local and SST bundling configs.


23-35: ✅ Preview features validated for Prisma v6.15.0

I’ve checked that:

  • Your package.json pins both prisma and @prisma/client to version 6.15.0-integration-fix-prisma-client-dirname-aws-lambda.3.
  • The schema snippet enables
    previewFeatures = ["driverAdapters", "queryCompiler"]
  • Both queryCompiler and driverAdapters were introduced in Prisma v6.7.0 and remain supported in v6.15.0 – enabling them together is the correct setup to remove the Rust query engine binary in favor of JS drivers (prisma.io).

No changes are needed here; the README example already matches the installed Prisma version.

generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts (1)

29-29: Good: include requestId in error logs.

Including requestId helps correlate logs across systems.

@@ -0,0 +1,168 @@
# Prisma Postgres Example: AWS Lambda + SST + Node.js + ESM

This project showcases how to use the Prisma ORM with AWS Lambda and Prisma Postgres in an TypeScript ESM application.
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Grammar: “an TypeScript” → “a TypeScript”.

Minor article fix; also keeps the ESM statement consistent with the project.

-This project showcases how to use the Prisma ORM with AWS Lambda and Prisma Postgres in an TypeScript ESM application.
+This project showcases how to use the Prisma ORM with AWS Lambda and Prisma Postgres in a TypeScript ESM application.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
This project showcases how to use the Prisma ORM with AWS Lambda and Prisma Postgres in an TypeScript ESM application.
This project showcases how to use the Prisma ORM with AWS Lambda and Prisma Postgres in a TypeScript ESM application.
🧰 Tools
🪛 LanguageTool

[grammar] ~3-~3: Use articles correctly
Context: ... with AWS Lambda and Prisma Postgres in an TypeScript ESM application. ## Prerequ...

(QB_NEW_EN_OTHER_ERROR_IDS_11)


[grammar] ~3-~3: Use correct spacing
Context: ...stgres in an TypeScript ESM application. ## Prerequisites To successfully run the p...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🤖 Prompt for AI Agents
In generator-prisma-client/aws-lambda-sst-esbuild/README.md around line 3, the
phrase "an TypeScript ESM application" uses the incorrect article; change "an"
to "a" so it reads "a TypeScript ESM application" to fix the grammar and keep
the ESM statement consistent.

Comment on lines +16 to +20
- SST 3 + AWS Lambda
- Runtime: Nodejs 20.x
- Bundler: esbuild (used via SST)
- `package.json` contains `{ "type": "module" }`
- Prisma Client with the `prisma-client` generator
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consistency: “Nodejs” → “Node.js”; clarify esbuild via SST.

Tiny polish for correctness and consistency.

-- SST 3 + AWS Lambda
-  - Runtime: Nodejs 20.x
-  - Bundler: esbuild (used via SST)
+- SST 3 + AWS Lambda
+  - Runtime: Node.js 20.x
+  - Bundler: esbuild (via SST)
   - `package.json` contains `{ "type": "module" }`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- SST 3 + AWS Lambda
- Runtime: Nodejs 20.x
- Bundler: esbuild (used via SST)
- `package.json` contains `{ "type": "module" }`
- Prisma Client with the `prisma-client` generator
- SST 3 + AWS Lambda
- Runtime: Node.js 20.x
- Bundler: esbuild (via SST)
- `package.json` contains `{ "type": "module" }`
- Prisma Client with the `prisma-client` generator
🧰 Tools
🪛 LanguageTool

[grammar] ~16-~16: There might be a mistake here.
Context: ...s). ## Tech Stack - SST 3 + AWS Lambda - Runtime: Nodejs 20.x - Bundler: esbuil...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ...tack - SST 3 + AWS Lambda - Runtime: Nodejs 20.x - Bundler: esbuild (used via SST...

(QB_NEW_EN_OTHER)


[grammar] ~17-~17: There might be a mistake here.
Context: ... 3 + AWS Lambda - Runtime: Nodejs 20.x - Bundler: esbuild (used via SST) - `pac...

(QB_NEW_EN)


[grammar] ~20-~20: There might be a mistake here.
Context: ...lient with the prisma-client generator See the [Prisma schema file](./prisma/sc...

(QB_NEW_EN_OTHER)

🤖 Prompt for AI Agents
In generator-prisma-client/aws-lambda-sst-esbuild/README.md around lines 16 to
20, update the wording for consistency and clarity: change "Nodejs 20.x" to
"Node.js 20.x" and rephrase the esbuild line to make clear that esbuild is used
via SST (e.g., "Bundler: esbuild (invoked by SST)") while retaining the note
about package.json containing { "type": "module" } and the Prisma Client
generator mention.

@@ -0,0 +1,36 @@
import { APIGatewayProxyEventV2 } from 'aws-lambda';
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Add explicit return type for Lambda v2 responses.

Improves type safety and IDE hints; use APIGatewayProxyStructuredResultV2.

-import { APIGatewayProxyEventV2 } from 'aws-lambda';
+import { APIGatewayProxyEventV2, APIGatewayProxyStructuredResultV2 } from 'aws-lambda';
@@
-export const handler = async (evt: APIGatewayProxyEventV2) => {
+export const handler = async (evt: APIGatewayProxyEventV2): Promise<APIGatewayProxyStructuredResultV2> => {

Also applies to: 7-7

🤖 Prompt for AI Agents
In generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts around lines 1
and 7, the Lambda v2 handler is missing an explicit return type; import and use
APIGatewayProxyStructuredResultV2 from 'aws-lambda' and annotate the handler's
return type as APIGatewayProxyStructuredResultV2 (and update any other exported
handler declarations on line 7) so responses are strongly typed and IDE hints
improve.

Comment on lines +8 to +19
if (evt.requestContext.http.method !== 'GET') {
return {
statusCode: 405,
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Allow': 'GET',
},
body: JSON.stringify({
error: 'Method Not Allowed',
}),
};
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Handle CORS and OPTIONS preflight; return canonical headers consistently.

If this Lambda is called from a browser via Lambda URL, add CORS headers and an OPTIONS handler. Also include “Allow: GET, OPTIONS” on 405.

 export const handler = async (evt: APIGatewayProxyEventV2) => {
-  if (evt.requestContext.http.method !== 'GET') {
+  const method = evt.requestContext.http.method
+  const cors = {
+    'Access-Control-Allow-Origin': '*',
+    'Access-Control-Allow-Methods': 'GET, OPTIONS',
+    'Access-Control-Allow-Headers': '*',
+    'Vary': 'Origin',
+    'Content-Type': 'application/json; charset=utf-8',
+  } as const
+
+  if (method === 'OPTIONS') {
+    return { statusCode: 204, headers: cors, body: '' }
+  }
+
+  if (method !== 'GET') {
     return {
       statusCode: 405,
-      headers: {
-        'Content-Type': 'application/json; charset=utf-8',
-        'Allow': 'GET',
-      },
+      headers: { ...cors, 'Allow': 'GET, OPTIONS' },
       body: JSON.stringify({
         error: 'Method Not Allowed',
       }),
     };
   }
@@
-    return {
-      statusCode: 200,
-      headers: { 'Content-Type': 'application/json; charset=utf-8' },
-      body: JSON.stringify({ data: quotes }),
-    }
+    return { statusCode: 200, headers: cors, body: JSON.stringify({ data: quotes }) }
@@
-    return {
-      statusCode: 500,
-      headers: { 'Content-Type': 'application/json; charset=utf-8' },
-      body: JSON.stringify({ error: 'Internal Server Error' }),
-    }
+    return { statusCode: 500, headers: cors, body: JSON.stringify({ error: 'Internal Server Error' }) }

Also applies to: 23-27, 29-34

🤖 Prompt for AI Agents
In generator-prisma-client/aws-lambda-sst-esbuild/src/index.ts around lines 8-19
(also apply same changes to 23-27 and 29-34), the handler does not support
OPTIONS preflight and lacks consistent CORS headers; update the function to
early-handle evt.requestContext.http.method === 'OPTIONS' by returning 204 with
the same CORS headers, add Access-Control-Allow-Origin,
Access-Control-Allow-Methods (including GET and OPTIONS), and
Access-Control-Allow-Headers to every response, and change the 405 response's
Allow header to "GET, OPTIONS" so all responses use the canonical CORS and Allow
header set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants