Skip to content

fix: add force-dynamic to API route to prevent build-time OXLO_API_KEY error - #9

Merged
ms-shashank merged 1 commit into
devfrom
feat/security-scanner-v2
Apr 28, 2026
Merged

fix: add force-dynamic to API route to prevent build-time OXLO_API_KEY error#9
ms-shashank merged 1 commit into
devfrom
feat/security-scanner-v2

Conversation

@ms-shashank

Copy link
Copy Markdown
Collaborator

No description provided.

…Y error

Next.js Turbopack evaluates route modules during 'Collecting page data'
which triggers the OXLO_API_KEY check. Adding dynamic='force-dynamic'
tells Next.js to skip static evaluation for this route entirely.
@vercel

vercel Bot commented Apr 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
oxtools Ready Ready Preview, Comment Apr 28, 2026 7:08am

Request Review

@oxlo-ai oxlo-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

OxBot Review

This PR fixes a Next.js build-time failure by adding force-dynamic to the unified API route, preventing static generation when OXLO_API_KEY is unavailable in CI. It also improves the Oxlo client error message and clarifies lazy initialization via JSDoc. Clean, focused fix.

Notes

  • The force-dynamic export is the correct and minimal fix for API routes that depend on request-time environment variables. Good call catching the build-time static generation issue.
  • Improving the error message to mention the x-api-key header is a nice UX touch that will help developers self-serve when integrating tools.

Verdict: LGTM | No inline issues found


Automated review by OxBot

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

OxBot Review

This PR correctly fixes a Next.js build-time failure by marking the tools API route as force-dynamic, preventing static generation without the OXLO_API_KEY. It also improves the Oxlo client helper to resolve the API key lazily and provides a clearer error message.

Verdict: LGTM | 0 inline comment(s)


Automated code review by OxBot

No inline issues found.

@ms-shashank
ms-shashank merged commit 755f77b into dev Apr 28, 2026
5 checks passed
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