Cap icon indicating copy to clipboard operation
Cap copied to clipboard

[Bug] Self-hosted instance requires Stripe subscription for organization invites

Open webvijayi opened this issue 1 year ago • 4 comments

[Bug] Self-hosted instance requires Stripe subscription for organization invites

Environment

  • Deployment: Self-hosted via Docker Compose
  • Cap Web Version: ghcr.io/capsoftware/cap-web:latest
  • Database: MySQL 9
  • Storage: MinIO (S3-compatible)
  • OS: AlmaLinux

Problem 1: Organization Invite Failure

Description

When a user tries to accept an organization invite on a self-hosted Cap instance, they receive the error:

Failed to accept invite: {"error":"Organization owner not found or has no subscription"}

Steps to Reproduce

  1. Set up self-hosted Cap Web using docker-compose.template.yml
  2. Create organization with admin user (e.g., [email protected])
  3. Send invite to another user
  4. Invited user clicks invite link and tries to accept
  5. Error occurs: "Organization owner not found or has no subscription"

Expected Behavior

Self-hosted instances should not require Stripe subscriptions. Organization invites should work without payment processing integration.

Actual Behavior

The application checks for stripeCustomerId, stripeSubscriptionId, and stripeSubscriptionStatus in the users table, even though:

  • The docker-compose.template.yml has NO Stripe-related environment variables
  • The self-hosting documentation doesn't mention Stripe configuration
  • Self-hosted deployments shouldn't require payment processing

Current Workaround

Manually setting fake Stripe data in the database bypasses the check:

UPDATE users
SET stripeCustomerId='cus_selfhosted',
    stripeSubscriptionId='sub_selfhosted',
    stripeSubscriptionStatus='active'
WHERE email='[email protected]';

Root Cause

The code enforces subscription checks even for self-hosted instances where billing is not applicable.


Problem 2: Desktop App Integration Documentation

Description

The ability to connect Cap Desktop to a self-hosted Cap Web instance is not prominently documented, leading to confusion about whether this feature is supported.

Current State

  • The desktop app CAN connect to self-hosted instances via "Cap Server URL" setting
  • This is briefly mentioned in the self-hosting docs but could be more prominent
  • Users may assume desktop app only works with cap.so cloud service

Suggestion

Improve documentation to clearly show:

  1. How to configure Cap Desktop to use a self-hosted server
  2. Any CORS requirements for S3 storage
  3. Troubleshooting steps if uploads fail

Proposed Solution

For Subscription Check Issue:

  1. Add environment variable like DISABLE_BILLING=true for self-hosted instances
  2. Skip all Stripe/subscription checks when this flag is set
  3. Update docker-compose.template.yml to include this variable by default

For Desktop Integration:

  1. Add dedicated section in self-hosting docs about desktop app configuration
  2. Include screenshots showing where to find "Cap Server URL" setting
  3. Document any S3/MinIO CORS requirements for desktop uploads

Configuration Details

docker-compose.yml environment variables (relevant excerpt):

services:
  cap-web:
    image: ghcr.io/capsoftware/cap-web:latest
    environment:
      DATABASE_URL: "mysql://capuser:password@cap-mysql:3306/planetscale"
      WEB_URL: "https://cap.example.com"
      NEXTAUTH_URL: "https://cap.example.com"
      # No Stripe variables configured
      S3_ENDPOINT: "http://cap-minio:9000"
      # ... other S3 configs

Database Schema:

users table has: stripeCustomerId, stripeSubscriptionId, stripeSubscriptionStatus
organizations table has: ownerId (references users.id)

Impact

  • High: Prevents organization collaboration on self-hosted instances
  • Workaround exists: Database manipulation (not ideal)
  • Affects: All self-hosted deployments

Related

  • Self-hosting docs: https://cap.so/docs/self-hosting
  • Docker template: docker-compose.template.yml

Would appreciate guidance on:

  1. Is billing enforcement intentional for self-hosted instances?
  2. Should we use environment variables or a different approach to disable it?
  3. Are there other features that require Stripe subscriptions in self-hosted mode?

Thank you for this amazing open-source project!

webvijayi avatar Nov 24 '25 01:11 webvijayi

CAP-558

linear[bot] avatar Nov 24 '25 01:11 linear[bot]

Facing the same issue - this is a blocker for organizational adoption.

kaijiabo avatar Nov 29 '25 06:11 kaijiabo

Fwiw, here's how you can run the fix mentioned by @webvijayi (thanks!) in docker compose if you're using that for your deployment:

# Navigate to your Cap directory, e.g.:
cd /opt/Cap

# Enter mysql - you'll be prompted for your mysql password (not the mysql root password), check your .env file
docker compose exec mysql mysql -u cap -p

# In mysql - replace with your email address below:
USE cap;

UPDATE users
SET stripeCustomerId='cus_selfhosted',
    stripeSubscriptionId='sub_selfhosted',
    stripeSubscriptionStatus='active'
WHERE email='[email protected]';

olieidel avatar Apr 07 '26 07:04 olieidel

The code path that required Stripe to send organization invites on self-hosted instances no longer exists. This should be in the latest release, please reopen if invites still fail without Stripe configured.

richiemcilroy avatar Aug 02 '26 23:08 richiemcilroy