Skip to content

tem algo errado no passo 7#7932

Open
RAUNIFCE wants to merge 1 commit into
prisma:mainfrom
RAUNIFCE:patch-1
Open

tem algo errado no passo 7#7932
RAUNIFCE wants to merge 1 commit into
prisma:mainfrom
RAUNIFCE:patch-1

Conversation

@RAUNIFCE
Copy link
Copy Markdown

@RAUNIFCE RAUNIFCE commented Jun 3, 2026

resolvi aprender somente na documentação,porém o código do passo 7 deu erro,fui pesquisar isso e descobri que O erro de tipos acontece porque process.env.DATABASE_HOST retorna string | undefined no TypeScript, mas o construtor do PrismaMariaDb espera string — sem o undefined. só coloquei os ! para ficar como not undefined

Summary by CodeRabbit

  • Documentation
    • Updated MySQL quickstart guide with improved environment variable handling in the Prisma adapter configuration to ensure proper validation of all required database credentials (host, user, password, and database name) for more reliable database connection setup.

resolvi aprender somente na documentação,porém o código do passo 7 deu erro,fui pesquisar isso e descobri que O erro de tipos acontece porque process.env.DATABASE_HOST retorna string | undefined no TypeScript, mas o construtor do PrismaMariaDb espera string — sem o undefined.
só coloquei os ! para ficar como not undefined
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

@RAUNIFCE is attempting to deploy a commit to the Prisma Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

Walkthrough

This PR updates the MySQL quickstart documentation to demonstrate proper type-safe environment variable handling. The code example in lib/prisma.ts now uses TypeScript non-null assertions when reading required database connection variables, making explicit that host, user, password, and database must be defined.

Changes

MySQL Quickstart Documentation

Layer / File(s) Summary
Adapter configuration with non-null assertions
apps/docs/content/docs/(index)/prisma-orm/quickstart/mysql.mdx
The lib/prisma.ts code sample demonstrates reading DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, and DATABASE_NAME from environment variables with non-null assertions (!), ensuring TypeScript recognizes these as required non-undefined values passed to the MariaDB adapter.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "tem algo errado no passo 7" is in Portuguese and translates to "something is wrong in step 7," which is vague and doesn't clearly describe the technical change made—using non-null assertions on environment variables in the MySQL quickstart. Revise the title to be more specific and in English: e.g., 'Add non-null assertions to environment variables in MySQL quickstart' or 'Fix TypeScript type errors in Prisma MySQL adapter configuration'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/content/docs/`(index)/prisma-orm/quickstart/mysql.mdx:
- Around line 206-209: The quickstart MySQL example uses non-null assertions
like process.env.DATABASE_HOST!, process.env.DATABASE_USER!,
process.env.DATABASE_PASSWORD!, process.env.DATABASE_NAME! while the other guide
omits the `!`; make them consistent by removing the trailing `!` in the
quickstart example (adjust the PrismaMariaDb adapter config values to use
process.env.DATABASE_HOST, process.env.DATABASE_USER,
process.env.DATABASE_PASSWORD, process.env.DATABASE_NAME without the non-null
assertion).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7cc9660a-c0e0-4498-8a12-e80ae1eb78b0

📥 Commits

Reviewing files that changed from the base of the PR and between df7aeb2 and 565f9da.

📒 Files selected for processing (1)
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/mysql.mdx

Comment on lines +206 to +209
host: process.env.DATABASE_HOST!,
user: process.env.DATABASE_USER!,
password: process.env.DATABASE_PASSWORD!,
database: process.env.DATABASE_NAME!,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if the add-to-existing-project guide has the same pattern

# Search for PrismaMariaDb configuration in the add-to-existing-project guide
rg -A 10 'new PrismaMariaDb\(' apps/docs/content/docs/\(index\)/prisma-orm/add-to-existing-project/mysql.mdx

Repository: prisma/web

Length of output: 340


Align env var non-null assertions across the MySQL Prisma docs examples

In quickstart/mysql.mdx, the PrismaMariaDb adapter uses process.env.DATABASE_HOST!/! for the env vars, but the corresponding example in add-to-existing-project/mysql.mdx uses process.env.DATABASE_HOST (no !). Update one side so both guides present the same TypeScript pattern.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/docs/`(index)/prisma-orm/quickstart/mysql.mdx around lines
206 - 209, The quickstart MySQL example uses non-null assertions like
process.env.DATABASE_HOST!, process.env.DATABASE_USER!,
process.env.DATABASE_PASSWORD!, process.env.DATABASE_NAME! while the other guide
omits the `!`; make them consistent by removing the trailing `!` in the
quickstart example (adjust the PrismaMariaDb adapter config values to use
process.env.DATABASE_HOST, process.env.DATABASE_USER,
process.env.DATABASE_PASSWORD, process.env.DATABASE_NAME without the non-null
assertion).

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.

1 participant