(SP: 1) [FIX] Add Netlify runtime env diagnostics to db/index.ts#424
(SP: 1) [FIX] Add Netlify runtime env diagnostics to db/index.ts#424ViktorSvertoka merged 5 commits intodevelopfrom
Conversation
fix(about): update LinkedIn follower fallback to 1800
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📝 WalkthroughWalkthroughThe pull request relaxes mandatory Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
frontend/vitest.config.ts (1)
15-22:⚠️ Potential issue | 🟡 MinorFix inconsistent indentation in the
testblock.Same indentation issue as in
vitest.shop.config.ts. Theenv:key andAPP_ENVhave inconsistent indentation compared to sibling properties.🔧 Proposed fix
test: { - env: { - APP_ENV: 'local', - }, + env: { + APP_ENV: 'local', + }, environment: 'node', include: [🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/vitest.config.ts` around lines 15 - 22, In the vitest.config.ts file the test configuration block has inconsistent indentation for the env and APP_ENV keys; update the block so that the env object and its APP_ENV property align with the sibling properties (e.g., environment and include) inside the test object—locate the test: { ... } block and re-indent the env: and APP_ENV entries to the same column as environment and include so formatting is consistent with vitest.shop.config.ts.frontend/vitest.shop.config.ts (1)
15-22:⚠️ Potential issue | 🟡 MinorFix inconsistent indentation in the
testblock.The
envblock and its contents have inconsistent indentation compared to the rest of thetestconfiguration. Theenv:key uses 6 spaces whileAPP_ENVuses 4 spaces, and sibling properties likeenvironmentuse 4 spaces.🔧 Proposed fix
test: { - env: { - APP_ENV: 'local', - }, + env: { + APP_ENV: 'local', + }, environment: 'node', include: ['lib/tests/shop/**/*.test.ts'],🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/vitest.shop.config.ts` around lines 15 - 22, The test configuration block has inconsistent indentation for the env map; normalize indentation so keys align with other properties: adjust the "test" block's "env" key and its "APP_ENV" entry to use the same 4-space indentation as "environment", "include", and "setupFiles" — specifically update the "env", "APP_ENV" lines inside the test config in vitest.shop.config.ts (referencing the test block, env, APP_ENV, environment, include, setupFiles) so all sibling properties use consistent 4-space indentation.
🧹 Nitpick comments (1)
frontend/db/index.ts (1)
27-28: Consider logging a warning whenAPP_ENVis undefined.When
APP_ENVis undefined,IS_LOCAL_ENVbecomesfalse, causing silent fallback to the production Neon path. While this aids Netlify debugging, it could mask misconfiguration in other environments. Consider adding a warning:💡 Suggested improvement
const IS_LOCAL_ENV = APP_ENV === 'local'; + +if (!APP_ENV && process.env.NODE_ENV !== 'test') { + console.warn('[db] APP_ENV is undefined – defaulting to non-local mode'); +}Also note that
frontend/lib/env/auth.tsstill throws whenAPP_ENVis undefined (see context snippet 3), so import order may cause different failure modes. You may want to reconcile these behaviors once debugging is complete.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/db/index.ts` around lines 27 - 28, APP_ENV may be undefined causing silent fallback; update the initialization around IS_LOCAL_ENV to first check if APP_ENV is undefined and emit a clear warning (e.g., console.warn or the project logger) when it is, then compute const IS_LOCAL_ENV = APP_ENV === 'local'; locate the IS_LOCAL_ENV/APP_ENV usage in frontend/db/index.ts (and note related behavior in frontend/lib/env/auth.ts which throws) and reconcile the behaviors so configuration issues surface consistently across imports.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@frontend/vitest.config.ts`:
- Around line 15-22: In the vitest.config.ts file the test configuration block
has inconsistent indentation for the env and APP_ENV keys; update the block so
that the env object and its APP_ENV property align with the sibling properties
(e.g., environment and include) inside the test object—locate the test: { ... }
block and re-indent the env: and APP_ENV entries to the same column as
environment and include so formatting is consistent with vitest.shop.config.ts.
In `@frontend/vitest.shop.config.ts`:
- Around line 15-22: The test configuration block has inconsistent indentation
for the env map; normalize indentation so keys align with other properties:
adjust the "test" block's "env" key and its "APP_ENV" entry to use the same
4-space indentation as "environment", "include", and "setupFiles" — specifically
update the "env", "APP_ENV" lines inside the test config in
vitest.shop.config.ts (referencing the test block, env, APP_ENV, environment,
include, setupFiles) so all sibling properties use consistent 4-space
indentation.
---
Nitpick comments:
In `@frontend/db/index.ts`:
- Around line 27-28: APP_ENV may be undefined causing silent fallback; update
the initialization around IS_LOCAL_ENV to first check if APP_ENV is undefined
and emit a clear warning (e.g., console.warn or the project logger) when it is,
then compute const IS_LOCAL_ENV = APP_ENV === 'local'; locate the
IS_LOCAL_ENV/APP_ENV usage in frontend/db/index.ts (and note related behavior in
frontend/lib/env/auth.ts which throws) and reconcile the behaviors so
configuration issues surface consistently across imports.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e6248f22-7622-4d10-9440-42c17965ceef
📒 Files selected for processing (4)
frontend/db/index.tsfrontend/db/queries/categories/admin-categories.tsfrontend/vitest.config.tsfrontend/vitest.shop.config.ts
Diagnose why Netlify develop deploy runtime does not see APP_ENV and DATABASE_URL despite both being configured in Netlify dashboard (All scopes).
Summary by CodeRabbit
Bug Fixes
Tests