Skip to content

Fix buildz.ai workspace loading error#14

Draft
vdimarco wants to merge 1 commit into
mainfrom
cursor/fix-buildz-ai-workspace-loading-error-379b
Draft

Fix buildz.ai workspace loading error#14
vdimarco wants to merge 1 commit into
mainfrom
cursor/fix-buildz-ai-workspace-loading-error-379b

Conversation

@vdimarco

Copy link
Copy Markdown

Summary

This PR addresses two issues: a 500 error when loading /api/workspaces and a WebSocket connection failure on buildz.ai/workspace.

The /api/workspaces GET endpoint now includes defensive error handling, returning an empty list of workspaces on failure instead of a server error, allowing the page to load gracefully. Additionally, the Socket.IO client will now only attempt to connect in production environments if NEXT_PUBLIC_SOCKET_URL is explicitly configured. This prevents WebSocket connection errors when a socket server is not intended to be active or is misconfigured.

Fixes #(issue)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

The changes were validated locally. The /api/workspaces endpoint was tested to ensure it returns an empty array on error and the correct data otherwise. The Socket.IO initialization logic was verified to correctly skip connection when NEXT_PUBLIC_SOCKET_URL is not set in a production environment. Linters and existing tests were run to ensure no regressions.

Reviewers should focus on:

  1. The error handling in apps/sim/app/api/workspaces/route.ts to ensure graceful degradation.
  2. The conditional Socket.IO initialization in apps/sim/contexts/socket-context.tsx to confirm it correctly prevents connections when NEXT_PUBLIC_SOCKET_URL is absent in production.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos


Open in Cursor Open in Web

…cket init on NEXT_PUBLIC_SOCKET_URL to avoid failed WebSocket attempts in prod without socket server
@cursor

cursor Bot commented Sep 21, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@coderabbitai

coderabbitai Bot commented Sep 21, 2025

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/fix-buildz-ai-workspace-loading-error-379b

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.

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.

2 participants