Skip to content

fix(organizations): remove org calls when billing is disabled#1211

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/orgs
Sep 1, 2025
Merged

fix(organizations): remove org calls when billing is disabled#1211
waleedlatif1 merged 1 commit intostagingfrom
fix/orgs

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

remove org calls when billing is disabled to prevent the users that have billing disabled (OSS) from getting 404's. removed it from the places that programatically get called when the user loads into the platform,

Type of Change

  • Bug fix

Testing

Tested manually.

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)

@vercel
Copy link

vercel bot commented Sep 1, 2025

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

Project Deployment Preview Comments Updated (UTC)
sim Building Building Preview Comment Sep 1, 2025 4:48pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 1, 2025 4:48pm

@waleedlatif1 waleedlatif1 merged commit 9ccb760 into staging Sep 1, 2025
3 of 4 checks passed
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR addresses a bug where OSS (open source software) users were encountering 404 errors when organization-related API calls were made on deployments with billing disabled. The changes modify the organization store (apps/sim/stores/organization/store.ts) to add early returns that prevent organization API calls when the NEXT_PUBLIC_BILLING_ENABLED environment variable is false.

The implementation adds billing checks in three key methods:

  • loadData(): Returns early with empty organizations array and null active organization when billing is disabled
  • refreshOrganization(): Exits early to prevent organization refresh calls
  • createOrganization(): Returns early with an error message indicating organizations aren't available

This change fits into the codebase's architecture by maintaining the existing organization store structure while providing graceful degradation for OSS deployments. The organization functionality is inherently tied to billing and subscription systems, so when billing is disabled, the store appropriately falls back to a single-user mode without team/organization features. This allows the platform to function properly for individual users in OSS environments while preventing the 404 errors that were occurring during platform initialization.

Confidence score: 3/5

  • This PR addresses a real issue but has partial coverage that may leave some edge cases unhandled
  • Score reflects incomplete protection - some organization methods remain unguarded which could still cause issues if called programmatically
  • Pay close attention to apps/sim/stores/organization/store.ts to ensure all organization-related methods are consistently protected

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment on lines +55 to +67
if (!isBillingEnabled) {
logger.debug('Billing disabled, skipping organization data loading')
set({
organizations: [],
activeOrganization: null,
hasTeamPlan: false,
hasEnterprisePlan: false,
isLoading: false,
error: null,
lastFetched: Date.now(),
})
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Early return sets empty state when billing disabled, but other methods like setActiveOrganization and seat management aren't protected

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