Skip to content

fix(cli): add Better-Auth + Convex setup instructions#831

Merged
AmanVarshney01 merged 4 commits intoAmanVarshney01:mainfrom
Noisemaker111:fix/convex-better-auth-instructions-v3
Feb 6, 2026
Merged

fix(cli): add Better-Auth + Convex setup instructions#831
AmanVarshney01 merged 4 commits intoAmanVarshney01:mainfrom
Noisemaker111:fix/convex-better-auth-instructions-v3

Conversation

@Noisemaker111
Copy link
Contributor

@Noisemaker111 Noisemaker111 commented Jan 18, 2026

Closes #828

Users running npx convex env set from project root got 'convex' is not found error because the Convex CLI is only available in packages/backend. This adds clear instructions in the post-installation output showing how to set BETTER_AUTH_SECRET and SITE_URL from the correct directory.

Changes

  • Added getBetterAuthConvexInstructions() function in post-installation.ts
  • Shows setup instructions when using Convex + Better-Auth:
    • cd packages/backend
    • npx convex env set BETTER_AUTH_SECRET=$(openssl rand -base64 32)
    • npx convex env set SITE_URL http://localhost:3001

Before

Users had no guidance on where to run convex commands from.

After

Post-installation output now clearly shows:

Better Auth + Convex Setup:
• Set environment variables from packages/backend:
   cd packages/backend
   npx convex env set BETTER_AUTH_SECRET=$(openssl rand -base64 32)
   npx convex env set SITE_URL http://localhost:3001

Summary by CodeRabbit

  • Chores
    • Improved post-installation setup instructions for Better Auth + Convex integration.
    • Automatically includes guidance to set the required secret and, when a web frontend is detected, to provide the site URL.
    • Ensures the new instruction block is shown in relevant installs and appears before related informational warnings.

Note

Adds post-install guidance for Better Auth + Convex setups and integrates it into the CLI output.

  • New getBetterAuthConvexInstructions() generates env setup steps (cd packages/backend, convex env set BETTER_AUTH_SECRET, conditional SITE_URL using detected webPort and package manager)
  • Shown only when backend is Convex and auth is better-auth; included in final post-install message before warnings
  • Minor refactor: compute webPort; preserve existing warnings and other instructions

Written by Cursor Bugbot for commit 2e8d385. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Jan 18, 2026

@Noisemaker111 is attempting to deploy a commit to the Better T Stack Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working cli Changes to the CLI tool labels Jan 18, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Adds an internal helper to generate Better Auth + Convex post-install instructions (including BETTER_AUTH_SECRET and conditional SITE_URL), injects its output into the post-install display when applicable, and reorders two internal warnings. Public API signatures remain unchanged.

Changes

Cohort / File(s) Summary
Better Auth + Convex post-install flow
apps/cli/src/helpers/core/post-installation.ts
Adds getBetterAuthConvexInstructions(hasWeb, webPort, packageManager) to build BETTER_AUTH_SECRET and conditional SITE_URL instructions; computes betterAuthConvexInstructions when isConvex && config.auth === "better-auth" and appends it to the rendered post-install steps when non-empty. Moves bunWebNativeWarning and noOrmWarning declarations to occur after the new instruction block. Exported function signatures unchanged.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding Better-Auth + Convex setup instructions to the CLI post-installation output.
Linked Issues check ✅ Passed The PR directly addresses issue #828 by adding post-installation instructions that guide users to run Convex env commands from packages/backend with proper BETTER_AUTH_SECRET and SITE_URL setup.
Out of Scope Changes check ✅ Passed All changes are strictly scoped to adding Better-Auth + Convex setup instructions in post-installation.ts; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Users were running  from project root which fails
because the convex CLI is only available in packages/backend. This adds
clear instructions to the post-installation output showing how to set
BETTER_AUTH_SECRET and SITE_URL from the correct directory.

Closes #XXXX
@Noisemaker111 Noisemaker111 force-pushed the fix/convex-better-auth-instructions-v3 branch from 5d98b9a to ae542e3 Compare January 18, 2026 04:09
@AmanVarshney01 AmanVarshney01 enabled auto-merge (squash) January 23, 2026 14:02
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

`${pc.white(` ${cmd} convex env set BETTER_AUTH_SECRET=$(openssl rand -base64 32)`)}\n` +
(hasWeb ? `${pc.white(` ${cmd} convex env set SITE_URL http://localhost:${webPort}`)}\n` : "")
);
}
Copy link

Choose a reason for hiding this comment

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

Wrong package runner command for pnpm and bun

Medium Severity

The getBetterAuthConvexInstructions function generates incorrect commands for pnpm and bun package managers. The pattern packageManager === "npm" ? "npx" : packageManager produces pnpm convex env set and bun convex env set, but pnpm requires pnpm dlx or pnpm exec to run binaries, and bun requires bunx. The codebase already has getPackageExecutionCommand in package-runner.ts that handles this correctly. This defeats the PR's purpose since pnpm/bun users will still encounter errors when following the setup instructions.

Fix in Cursor Fix in Web

@AmanVarshney01 AmanVarshney01 merged commit 0b77363 into AmanVarshney01:main Feb 6, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli Changes to the CLI tool size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tanstack Convex Cloudflare BetterAuth setup gives an error

2 participants