Skip to content

fix: add missing env vars to docker-compose and fix Greeting hydration bug#1922

Open
anupborker wants to merge 1 commit intocode100x:mainfrom
anupborker:fix/docker-env-greeting-hydration
Open

fix: add missing env vars to docker-compose and fix Greeting hydration bug#1922
anupborker wants to merge 1 commit intocode100x:mainfrom
anupborker:fix/docker-env-greeting-hydration

Conversation

@anupborker
Copy link
Copy Markdown

What does this PR do?

  • Adds missing environment variables to docker-compose.yml so the app works out of the box without manual .env edits
  • Fixes a React hydration mismatch in Greeting.tsx caused by time-based greeting differing between server and client render

Changes

docker-compose.yml

  • Added LOCAL_CMS_PROVIDER, NEXTAUTH_URL, NEXTAUTH_SECRET, JWT_SECRET, ADMIN_SECRET to the environment block
  • Added NEXT_PUBLIC_BASE_URL_LOCAL so API calls resolve correctly inside the container

src/components/Greeting.tsx

  • Moved time-based greeting logic into useEffect with useState('') initial value
  • Server and client now agree on the initial render, eliminating the hydration error

Why?

Without these env vars, Docker login would fail with TypeError: Failed to parse URL from undefined/post/userLogin. New contributors had no way to know which vars were missing since only DATABASE_URL was passed to the container.

The Greeting hydration bug caused the entire root to switch to client rendering, flooding the console with errors on every page load.

Checklist before requesting a review

  • I have performed a self-review of my code
  • I assure there is no similar/duplicate pull request regarding same issue

…n bug

- Add NEXTAUTH_SECRET, NEXTAUTH_URL, JWT_SECRET, ADMIN_SECRET, LOCAL_CMS_PROVIDER to docker-compose.yml so login works out of the box
- Fix hydration mismatch in Greeting.tsx by deferring time-based greeting to useEffect

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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