Skip to content

convex fix auth config bug#1031

Merged
BilalG1 merged 2 commits intodevfrom
convex-import-fix
Nov 26, 2025
Merged

convex fix auth config bug#1031
BilalG1 merged 2 commits intodevfrom
convex-import-fix

Conversation

@BilalG1
Copy link
Contributor

@BilalG1 BilalG1 commented Nov 26, 2025

Summary by CodeRabbit

  • New Features

    • Added new ./convex-auth.config export path for Convex authentication configuration across all packages.
  • Documentation

    • Updated documentation and examples with new import paths for Convex auth integration in JavaScript, React, and Next.js projects.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Nov 26, 2025

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

Project Deployment Preview Comments Updated (UTC)
stack-backend Ready Ready Preview Comment Nov 26, 2025 7:29pm
stack-dashboard Ready Ready Preview Comment Nov 26, 2025 7:29pm
stack-demo Ready Ready Preview Comment Nov 26, 2025 7:29pm
stack-docs Ready Ready Preview Comment Nov 26, 2025 7:29pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Walkthrough

This PR introduces a new public export subpath ./convex-auth.config across multiple packages, updates import examples to use this new subpath, reorganizes the tsup build configuration to include a new barrel file, and refactors WebAuthn-related imports from dynamic to static in the server app implementation.

Changes

Cohort / File(s) Summary
Package Export Configuration
packages/js/package.json, packages/react/package.json, packages/stack/package.json, packages/template/package.json, packages/template/package-template.json
Added new public export ./convex-auth.config with types pointing to ./dist/integrations/convex.d.ts and imports pointing to the corresponding ESM and CommonJS runtime files.
Import Statement Updates
examples/convex/convex/auth.config.ts, packages/template/src/integrations/convex/component/README.md
Updated imports from generic package paths to use the new subpath ./convex-auth.config (e.g., @stackframe/stack@stackframe/stack/convex-auth.config).
Build Configuration
packages/template/tsup.config.ts
Added src/integrations/convex.ts to the barrelFiles array for build configuration.
WebAuthn Import Refactoring
packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts
Replaced dynamic imports of startRegistration, WebAuthnError, and captureError with static imports in the passkey registration flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Package.json consistency: Verify the new export entry across all five package files follows the same structure and points to correct runtime/type files.
  • Import path correctness: Confirm that the new @stackframe/.../convex-auth.config subpath actually resolves to the exported modules in the built artifacts.
  • Static import migration: Review the WebAuthn import refactoring in server-app-impl.ts to ensure error handling and type availability are preserved after moving from dynamic to static imports.
  • Barrel file impact: Assess whether adding src/integrations/convex.ts to tsup's barrelFiles produces the expected build output and doesn't conflict with existing exports.

Possibly related PRs

  • stack-auth/stack-auth#999: Updates the same Convex integration README and example imports to use the new subpath exports.
  • stack-auth/stack-auth#913: Adds Convex integration support and related exports that complement the new ./convex-auth.config subpath introduced here.

Suggested reviewers

  • N2D4

Poem

🐰 A new export path hops into view,
convex-auth.config for me and for you!
With static imports and barrel files bright,
The WebAuthn flow takes flight—everything's right! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is empty except for the template header comment. No meaningful context, rationale, or details about the changes are provided. Add a detailed description explaining what the PR does, why the changes are necessary, and what bug is being fixed. Include information about the new export entries and import path updates.
Title check ❓ Inconclusive The title 'convex fix auth config bug' is vague and lacks specificity. While it mentions 'convex' and 'auth config', it does not clearly communicate what the actual change is (adding new export entries and updating import paths). Provide a more specific title that describes the actual change, e.g., 'Add convex-auth.config export entries to package.json files' or 'Update Convex auth config import paths'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch convex-import-fix

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.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 26, 2025

Greptile Overview

Greptile Summary

Fixes import path for Convex integration by creating a dedicated /convex export. Previously, getConvexProvidersConfig was exported from the main package entry point, which could cause issues with tree-shaking and module resolution in Convex environments.

  • Removed getConvexProvidersConfig from main index exports
  • Added new /convex export path to all package.json files (@stackframe/js/convex, @stackframe/react/convex, @stackframe/stack/convex)
  • Updated tsup config to build src/integrations/convex.ts as a separate barrel file
  • Updated example and documentation to use new import path
  • Properly configured both ESM and CommonJS exports with TypeScript types

This change ensures the Convex integration can be imported without pulling in unnecessary dependencies from the main package.

Confidence Score: 5/5

  • Safe to merge - well-structured refactoring with proper exports and documentation
  • All changes are properly coordinated across packages, examples, and documentation. The export paths are correctly configured with types, ESM, and CommonJS support. No security concerns or breaking changes beyond the intended import path update.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
examples/convex/convex/auth.config.ts 5/5 Updated import path to use new /convex export
packages/js/package.json 5/5 Added /convex export path with proper types and module formats
packages/template/src/index.ts 5/5 Removed getConvexProvidersConfig export from main index (now in dedicated /convex path)
packages/template/tsup.config.ts 5/5 Added src/integrations/convex.ts as a barrel file for separate bundling

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant App as Convex App
    participant Stack as Stack Package
    participant Convex as Convex Auth

    Note over Dev,Convex: Before: Import from main package
    Dev->>App: import { getConvexProvidersConfig } from "@stackframe/stack"
    App->>Stack: Load entire package (with unnecessary deps)
    Stack->>App: Return getConvexProvidersConfig + all exports
    App->>Convex: Configure auth with providers config
    
    Note over Dev,Convex: After: Import from dedicated /convex path
    Dev->>App: import { getConvexProvidersConfig } from "@stackframe/stack/convex"
    App->>Stack: Load only convex integration module
    Stack->>App: Return getConvexProvidersConfig (tree-shaken)
    App->>Convex: Configure auth with providers config
Loading

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.

9 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cb8806 and 90299be.

📒 Files selected for processing (9)
  • examples/convex/convex/auth.config.ts (1 hunks)
  • packages/js/package.json (1 hunks)
  • packages/react/package.json (1 hunks)
  • packages/stack/package.json (1 hunks)
  • packages/template/package-template.json (1 hunks)
  • packages/template/package.json (1 hunks)
  • packages/template/src/index.ts (0 hunks)
  • packages/template/src/integrations/convex/component/README.md (1 hunks)
  • packages/template/tsup.config.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/template/src/index.ts
🧰 Additional context used
📓 Path-based instructions (2)
packages/{stack,js}/**

📄 CodeRabbit inference engine (AGENTS.md)

Never update packages/stack or packages/js directly; update packages/template instead as the others are copies of that package

Files:

  • packages/stack/package.json
  • packages/js/package.json
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Ensure code passes pnpm typecheck for TypeScript type validation
Never use toast for blocking alerts and errors; use alerts instead as they are more visible to users
Keep hover/click transitions snappy and fast; apply transitions after the action (e.g., smooth fade-out on hover end) rather than delaying actions with pre-transitions to avoid sluggish UI
Never use try-catch-all, never void a promise, never use .catch(console.error) or similar; use runAsynchronously or runAsynchronouslyWithAlert for error handling instead of try-catch blocks
Use loading indicators instead of try-catch blocks for asynchronous UI operations; button components like support async callbacks with built-in loading state
Use ES6 maps instead of records wherever possible

Files:

  • packages/template/tsup.config.ts
  • examples/convex/convex/auth.config.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to packages/stack-shared/src/config/** : When making backwards-incompatible changes to the config schema, update the migration functions in `packages/stack-shared/src/config/schema.ts`
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to packages/{stack,js}/** : Never update packages/stack or packages/js directly; update packages/template instead as the others are copies of that package
📚 Learning: 2025-11-25T02:09:03.104Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to **/apps-{frontend,config}.{ts,tsx} : To update available apps, edit `apps-frontend.tsx` and `apps-config.ts`

Applied to files:

  • packages/template/src/integrations/convex/component/README.md
📚 Learning: 2025-11-25T02:09:03.104Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to packages/stack-shared/src/config/** : When making backwards-incompatible changes to the config schema, update the migration functions in `packages/stack-shared/src/config/schema.ts`

Applied to files:

  • packages/template/tsup.config.ts
  • examples/convex/convex/auth.config.ts
🧬 Code graph analysis (1)
packages/template/tsup.config.ts (1)
configs/tsup/js-library.ts (1)
  • createJsLibraryTsupConfig (33-64)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: restart-dev-and-test-with-custom-base-port
  • GitHub Check: check_prisma_migrations (22.x)
  • GitHub Check: setup-tests
  • GitHub Check: build (22.x)
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: docker
  • GitHub Check: build (22.x)
  • GitHub Check: restart-dev-and-test
  • GitHub Check: all-good
  • GitHub Check: build (22.x)
🔇 Additional comments (5)
examples/convex/convex/auth.config.ts (1)

1-1: LGTM: Import path updated to use dedicated convex export.

The import path change from @stackframe/stack to @stackframe/stack/convex correctly aligns with the new dedicated export path being introduced across the Stack packages.

packages/template/src/integrations/convex/component/README.md (1)

20-22: LGTM: Documentation updated to reflect new convex-specific import paths.

The code examples correctly demonstrate importing from the new dedicated /convex export path for each package variant.

packages/template/package-template.json (1)

36-45: LGTM: Correct file for template changes.

This is the proper source file to edit. The new "./convex" export entry is correctly structured and will be propagated to all generated package.json files when the template generation script runs.

Ensure that you run the template generation script to update packages/template/package.json, packages/js/package.json, packages/stack/package.json, and packages/react/package.json from this template, or remove the manual edits from those files if they were added by mistake.

packages/template/tsup.config.ts (1)

3-7: Barrel file exists and exports are correct.

The file packages/template/src/integrations/convex.ts exists and properly exports getConvexProvidersConfig() with appropriate TypeScript typing. The tsup configuration correctly references this barrel file, and the integration setup is valid.

packages/template/package.json (1)

27-36: Critical: Do not edit auto-generated files directly.

This file has a comment at line 2 stating "THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY". According to the coding guidelines, you should only edit packages/template/package-template.json and then run the generation script to update this file and others.

Based on coding guidelines, the correct approach is:

  1. Make changes only to packages/template/package-template.json
  2. Run the template generation script
  3. The script will automatically update packages/template/package.json, packages/js/package.json, packages/stack/package.json, and packages/react/package.json

Direct edits to this file will be overwritten on the next generation run.

⛔ Skipped due to learnings
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to packages/{stack,js}/** : Never update packages/stack or packages/js directly; update packages/template instead as the others are copies of that package
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to **/apps-{frontend,config}.{ts,tsx} : To update available apps, edit `apps-frontend.tsx` and `apps-config.ts`
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to packages/stack-shared/src/config/** : When making backwards-incompatible changes to the config schema, update the migration functions in `packages/stack-shared/src/config/schema.ts`

@BilalG1 BilalG1 requested a review from N2D4 November 26, 2025 17:56
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

♻️ Duplicate comments (2)
packages/js/package.json (1)

26-35: Critical: Do not edit auto-generated files directly.

Per the coding guidelines, packages/js should never be updated directly. This file is auto-generated from the template package.

Instead, make these changes in packages/template/package-template.json and run the package generation script to propagate them automatically.

Based on coding guidelines: "Never update packages/stack or packages/js directly; update packages/template instead as the others are copies of that package"

packages/react/package.json (1)

26-35: Critical: Do not edit auto-generated files directly.

This file is auto-generated from the template package and should not be modified directly. The same guideline applies here as with packages/js.

Make changes only in packages/template/package-template.json, then run the generation script to propagate them to this file.

Based on coding guidelines for template-generated packages.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90299be and 7afcab5.

📒 Files selected for processing (8)
  • examples/convex/convex/auth.config.ts (1 hunks)
  • packages/js/package.json (1 hunks)
  • packages/react/package.json (1 hunks)
  • packages/stack/package.json (1 hunks)
  • packages/template/package-template.json (1 hunks)
  • packages/template/package.json (1 hunks)
  • packages/template/src/integrations/convex/component/README.md (1 hunks)
  • packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/stack/package.json
  • packages/template/package-template.json
🧰 Additional context used
📓 Path-based instructions (2)
packages/{stack,js}/**

📄 CodeRabbit inference engine (AGENTS.md)

Never update packages/stack or packages/js directly; update packages/template instead as the others are copies of that package

Files:

  • packages/js/package.json
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Ensure code passes pnpm typecheck for TypeScript type validation
Never use toast for blocking alerts and errors; use alerts instead as they are more visible to users
Keep hover/click transitions snappy and fast; apply transitions after the action (e.g., smooth fade-out on hover end) rather than delaying actions with pre-transitions to avoid sluggish UI
Never use try-catch-all, never void a promise, never use .catch(console.error) or similar; use runAsynchronously or runAsynchronouslyWithAlert for error handling instead of try-catch blocks
Use loading indicators instead of try-catch blocks for asynchronous UI operations; button components like support async callbacks with built-in loading state
Use ES6 maps instead of records wherever possible

Files:

  • packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts
  • examples/convex/convex/auth.config.ts
🧠 Learnings (4)
📚 Learning: 2025-11-25T02:09:03.104Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to **/apps-{frontend,config}.{ts,tsx} : To update available apps, edit `apps-frontend.tsx` and `apps-config.ts`

Applied to files:

  • packages/template/src/integrations/convex/component/README.md
📚 Learning: 2025-11-25T02:09:03.104Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to packages/{stack,js}/** : Never update packages/stack or packages/js directly; update packages/template instead as the others are copies of that package

Applied to files:

  • packages/js/package.json
📚 Learning: 2025-10-11T04:13:19.308Z
Learnt from: N2D4
Repo: stack-auth/stack-auth PR: 943
File: examples/convex/app/action/page.tsx:23-28
Timestamp: 2025-10-11T04:13:19.308Z
Learning: In the stack-auth codebase, use `runAsynchronouslyWithAlert` from `stackframe/stack-shared/dist/utils/promises` for async button click handlers and form submissions instead of manual try/catch blocks. This utility automatically handles errors and shows alerts to users.

Applied to files:

  • packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts
📚 Learning: 2025-11-25T02:09:03.104Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T02:09:03.104Z
Learning: Applies to packages/stack-shared/src/config/** : When making backwards-incompatible changes to the config schema, update the migration functions in `packages/stack-shared/src/config/schema.ts`

Applied to files:

  • examples/convex/convex/auth.config.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: restart-dev-and-test-with-custom-base-port
  • GitHub Check: restart-dev-and-test
  • GitHub Check: setup-tests
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: build (22.x)
  • GitHub Check: all-good
  • GitHub Check: docker
  • GitHub Check: build (22.x)
  • GitHub Check: check_prisma_migrations (22.x)
  • GitHub Check: build (22.x)
🔇 Additional comments (3)
packages/template/src/integrations/convex/component/README.md (1)

20-22: LGTM! Documentation correctly reflects the new convex-auth.config subpath.

The updated import examples align with the new export structure and address the previous feedback requesting this naming convention.

packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts (1)

16-16: LGTM! Static imports improve build-time optimization.

Converting from dynamic to static imports for captureError, startRegistration, and WebAuthnError enables better tree-shaking and type checking without changing runtime behavior.

Also applies to: 38-38

examples/convex/convex/auth.config.ts (1)

1-1: LGTM! Import now uses the requested convex-auth.config subpath.

This change directly addresses the previous feedback to make the import path explicit for auth-specific configuration.

@BilalG1 BilalG1 merged commit a6bf1e8 into dev Nov 26, 2025
25 checks passed
@BilalG1 BilalG1 deleted the convex-import-fix branch November 26, 2025 19:36
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