Skip to content

fix: Make Docusaurus config resilient to missing env vars - #326

Merged
scott-klaytn merged 1 commit into
kaiachain:mainfrom
scott-klaytn:fix-production-error
Jun 25, 2025
Merged

scott-klaytn merged 1 commit into
kaiachain:mainfrom
scott-klaytn:fix-production-error

Conversation

@scott-klaytn

@scott-klaytn scott-klaytn commented Jun 24, 2025 •

Copy link
Copy Markdown
Contributor

✨ Proposed Changes

Symptom

GitHub Actions workflow failed with Docusaurus config errors (e.g. "scripts[0]" is invalid. A script must be a plain string (the src), or an object with at least a "src" property"), especially during steps without full environment variables.

Cause

Recent adoption of environment variables led to undefined values in docusaurus.config.js when secrets were unavailable (e.g. in Generate .mdx files step). This produced invalid script/config objects and triggered validation errors.

Solution

  • Script tags and Algolia config now use conditional logic: only included if relevant env vars are present.
  • Fallbacks (null) added for custom fields to prevent runtime errors.
  • Ensures config is always valid, regardless of environment.

Note: This issue was introduced after recent changes to use environment variables in the config.

🗂️ Types of changes

  • Minor Issues and Typos
  • Major Content Contribution
  • Others (e.g. platform-specific changes)

✅ Checklist

  • I have read the CONTRIBUTING GUIDELINES.
  • If following Standard Workflow: I have linked the approved issue below.
  • If submitting without a prior issue (Maintainer/Regular): I have provided detailed context in the "Proposed Changes" section above.
  • My changes render correctly (if applicable, run npm run build locally).
  • I have added necessary documentation updates (if appropriate).
  • Any dependent changes have been merged and published.

📌 Related issues

💡 Further comments

@github-actions

Copy link
Copy Markdown

Passed branch check

@scott-klaytn
scott-klaytn requested a review from adnpark June 24, 2025 07:45

@adnpark adnpark left a comment

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.

LGTM

@scott-klaytn
scott-klaytn merged commit df27574 into kaiachain:main Jun 25, 2025
@scott-klaytn
scott-klaytn deleted the fix-production-error branch June 25, 2025 05:02
@github-actions

Copy link
Copy Markdown

Passed branch check

@github-actions github-actions Bot locked and limited conversation to collaborators Jun 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants