Skip to content

feat(app-host): load plugin-auth on Vercel deployment#925

Merged
hotlong merged 3 commits into
mainfrom
copilot/load-plugin-auth-on-deploy
Mar 17, 2026
Merged

feat(app-host): load plugin-auth on Vercel deployment#925
hotlong merged 3 commits into
mainfrom
copilot/load-plugin-auth-on-deploy

Conversation

Copilot AI commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

examples/app-host (the hotcrm reference host) was not loading plugin-auth, meaning authentication was absent in Vercel deployments.

Changes

  • objectstack.config.ts — Import and register AuthPlugin in both the default stack and PreviewHostExample. Extracted as a shared authPlugin constant to avoid duplication. Resolves baseUrl from NEXT_PUBLIC_BASE_URLVERCEL_URL → localhost fallback.
const authPlugin = new AuthPlugin({
  secret: process.env.AUTH_SECRET ?? 'dev-secret-please-change-in-production-min-32-chars',
  baseUrl: process.env.NEXT_PUBLIC_BASE_URL ?? (process.env.VERCEL_URL
    ? `https://${process.env.VERCEL_URL}`
    : 'http://localhost:3000'),
});
  • package.json — Added @objectstack/plugin-auth: workspace:* to dependencies.
  • vercel.json — New Vercel deployment config referencing @auth_secret and @vercel_url environment secrets.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel

vercel Bot commented Mar 17, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Mar 17, 2026 5:31am
spec Ready Ready Preview, Comment Mar 17, 2026 5:31am

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add plugin-auth loading during Vercel deployment feat(app-host): load plugin-auth on Vercel deployment Mar 17, 2026
Copilot AI requested a review from hotlong March 17, 2026 04:48
@hotlong

hotlong commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator

@copilot 12:47:21.830  ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with /examples/app-host/package.json
12:47:21.859 Error: Command "cd ../.. && pnpm install" exited with 1

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Copilot AI commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 12:47:21.830  ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with /examples/app-host/package.json
12:47:21.859 Error: Com...

Fixed in commit 2080841. Ran pnpm install --no-frozen-lockfile to sync pnpm-lock.yaml with the new @objectstack/plugin-auth dependency added to examples/app-host/package.json.

@hotlong
hotlong marked this pull request as ready for review March 17, 2026 06:10
Copilot AI review requested due to automatic review settings March 17, 2026 06:10
@hotlong
hotlong merged commit 05a6fc4 into main Mar 17, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds @objectstack/plugin-auth to the examples/app-host stack so authentication is available in Vercel deployments (and locally), with environment-based baseUrl resolution and Vercel build configuration.

Changes:

  • Register AuthPlugin in the default app-host stack and PreviewHostExample, with shared env-based config.
  • Add @objectstack/plugin-auth as a dependency for @example/app-host (and update lockfile).
  • Add examples/app-host/vercel.json to configure Vercel build/install and environment variables.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
pnpm-lock.yaml Adds workspace link for @objectstack/plugin-auth in the app-host importer.
examples/app-host/vercel.json Introduces Vercel build/install commands and env wiring for deployment.
examples/app-host/package.json Adds @objectstack/plugin-auth dependency.
examples/app-host/objectstack.config.ts Imports and registers AuthPlugin and resolves baseUrl from env for Vercel/local use.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +18 to +23
const authPlugin = new AuthPlugin({
secret: process.env.AUTH_SECRET ?? 'dev-secret-please-change-in-production-min-32-chars',
baseUrl: process.env.NEXT_PUBLIC_BASE_URL ?? (process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: 'http://localhost:3000'),
});
Comment on lines +16 to +23
// Shared authentication plugin — reads secrets from environment variables so the
// same config works both locally and on Vercel (where VERCEL_URL is injected).
const authPlugin = new AuthPlugin({
secret: process.env.AUTH_SECRET ?? 'dev-secret-please-change-in-production-min-32-chars',
baseUrl: process.env.NEXT_PUBLIC_BASE_URL ?? (process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: 'http://localhost:3000'),
});
Comment on lines +40 to +41
// Authentication — required for production (Vercel) deployments
authPlugin,
Comment on lines +7 to +8
"AUTH_SECRET": "@auth_secret",
"VERCEL_URL": "@vercel_url"
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.

3 participants