feat(app-host): load plugin-auth on Vercel deployment#925
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@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 |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Fixed in commit |
There was a problem hiding this comment.
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
AuthPluginin the defaultapp-hoststack andPreviewHostExample, with shared env-based config. - Add
@objectstack/plugin-authas a dependency for@example/app-host(and update lockfile). - Add
examples/app-host/vercel.jsonto 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
| 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'), | ||
| }); |
| // 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'), | ||
| }); |
| // Authentication — required for production (Vercel) deployments | ||
| authPlugin, |
| "AUTH_SECRET": "@auth_secret", | ||
| "VERCEL_URL": "@vercel_url" |
examples/app-host(the hotcrm reference host) was not loadingplugin-auth, meaning authentication was absent in Vercel deployments.Changes
objectstack.config.ts— Import and registerAuthPluginin both the default stack andPreviewHostExample. Extracted as a sharedauthPluginconstant to avoid duplication. ResolvesbaseUrlfromNEXT_PUBLIC_BASE_URL→VERCEL_URL→ localhost fallback.package.json— Added@objectstack/plugin-auth: workspace:*to dependencies.vercel.json— New Vercel deployment config referencing@auth_secretand@vercel_urlenvironment 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.