Skip to content

Handle api workspace fetch error#18

Draft
vdimarco wants to merge 1 commit into
mainfrom
cursor/handle-api-workspace-fetch-error-010b
Draft

Handle api workspace fetch error#18
vdimarco wants to merge 1 commit into
mainfrom
cursor/handle-api-workspace-fetch-error-010b

Conversation

@vdimarco

Copy link
Copy Markdown

Summary

This PR addresses a 500 Internal Server Error previously encountered when accessing the /api/workspaces endpoint. The root causes were missing environment variables, a TypeScript type mismatch for activeOrganizationId on the session object, and uninstalled project dependencies.

The changes include:

  1. Installing Bun and project dependencies.
  2. Adding a type assertion to correctly handle activeOrganizationId in the session type.
  3. Populating the .env file with essential authentication and application URL variables.

As a result, the /api/workspaces endpoint now correctly returns a 401 Unauthorized response for unauthenticated requests, resolving the server error and the associated client-side retry loop.

Fixes #

Type of Change

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

Testing

The fix was verified by installing Bun, running bun install, configuring the .env file, and starting the development server. A direct request to the /api/workspaces endpoint confirmed that it now returns a 401 Unauthorized status, which is the expected behavior for unauthenticated access, instead of the previous 500 Internal Server Error.

Reviewers should focus on the type assertion in apps/sim/app/api/auth/socket-token/route.ts and the updated .env configuration.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (Manual verification of API endpoint response)
  • 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

Co-authored-by: vaughn.dimarco <vaughn.dimarco@gmail.com>
@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/handle-api-workspace-fetch-error-010b

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