Fix build and lint failures on dev (#1445)

This commit is contained in:
Konsti Wohlwend 2026-05-19 19:05:26 -07:00 committed by GitHub
parent 6e769c3be3
commit 2aa4affa54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 28 additions and 19 deletions

View File

@ -1,16 +1,16 @@
"use server";
import { isRemoteDevelopmentEnvironmentEnabled } from "@/lib/remote-development-environment/env";
async function getStackServerApp() {
async function getServerApp() {
if (isRemoteDevelopmentEnvironmentEnabled()) {
throw new Error("Team invitation management is not available in the remote development environment dashboard.");
}
return (await import("@/stack/server")).stackServerApp;
return (await import("@/stack/server")).getStackServerApp();
}
export async function revokeInvitation(teamId: string, invitationId: string) {
"use server";
const stackServerApp = await getStackServerApp();
const stackServerApp = await getServerApp();
const user = await stackServerApp.getUser();
const team = await user?.getTeam(teamId);
if (!team) {
@ -24,7 +24,7 @@ export async function revokeInvitation(teamId: string, invitationId: string) {
}
export async function listInvitations(teamId: string) {
const stackServerApp = await getStackServerApp();
const stackServerApp = await getServerApp();
const user = await stackServerApp.getUser();
const team = await user?.getTeam(teamId);
if (!team) {
@ -39,7 +39,7 @@ export async function listInvitations(teamId: string) {
}
export async function inviteUser(teamId: string, email: string, origin: string) {
const stackServerApp = await getStackServerApp();
const stackServerApp = await getServerApp();
const callbackUrl = new URL(stackServerApp.urls.teamInvitation, origin).toString();
const user = await stackServerApp.getUser();
const team = await user?.getTeam(teamId);

View File

@ -1,4 +1,4 @@
import { stackServerApp } from "@/stack/server";
import { getStackServerApp } from "@/stack/server";
import { getEnvVariable } from "@stackframe/stack-shared/dist/utils/env";
import { getOrCreateFeaturebaseUser } from "@stackframe/stack-shared/dist/utils/featurebase";
import { urlString } from "@stackframe/stack-shared/dist/utils/urls";
@ -21,7 +21,7 @@ export default async function FeaturebaseSSO({
return <div>Missing return_to parameter. Please go back and try again.</div>;
}
const user = await stackServerApp.getUser();
const user = await getStackServerApp().getUser();
if (!user) {
redirect(urlString`/handler/sign-in?after_auth_return_to=${urlString`/integrations/featurebase/sso?return_to=${returnTo}`}`);
}

View File

@ -1,4 +1,4 @@
import { stackServerApp } from "@/stack/server";
import { getStackServerApp } from "@/stack/server";
import { getEnvVariable } from "@stackframe/stack-shared/dist/utils/env";
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
import { redirect } from "next/navigation";
@ -18,7 +18,7 @@ export default async function IntegrationConfirmPage(props: {
const onContinue = async (options: { projectId: string, projectName?: string }) => {
"use server";
const user = await stackServerApp.getUser();
const user = await getStackServerApp().getUser();
if (!user) {
return { error: "unauthorized" };
}

View File

@ -13,8 +13,10 @@ import '../polyfills';
import './globals.css';
import { LayoutClient } from './layout-client';
const apiUrl = getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL');
export const metadata: Metadata = {
metadataBase: new URL(getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL') || ''),
...apiUrl ? { metadataBase: new URL(apiUrl) } : {},
title: {
default: 'Stack Auth Dashboard',
template: '%s | Stack Auth',
@ -23,12 +25,12 @@ export const metadata: Metadata = {
openGraph: {
title: 'Stack Auth Dashboard',
description: 'Stack Auth is the open-source Auth0 alternative, and the fastest way to add authentication to your web app.',
images: [`${getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL')}/open-graph-image.png`]
...apiUrl ? { images: [`${apiUrl}/open-graph-image.png`] } : {},
},
twitter: {
title: 'Stack Auth Dashboard',
description: 'Stack Auth is the open-source Auth0 alternative, and the fastest way to add authentication to your web app.',
images: [`${getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL')}/open-graph-image.png`]
...apiUrl ? { images: [`${apiUrl}/open-graph-image.png`] } : {},
},
};

View File

@ -5,10 +5,17 @@ import { StackServerApp } from "@stackframe/stack";
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
import { stackClientApp } from "./client";
if (isRemoteDevelopmentEnvironmentEnabled()) {
throw new StackAssertionError("stackServerApp is not available in the local remote development environment dashboard.");
}
type InternalServerApp = StackServerApp<true, "internal">;
let _stackServerApp: InternalServerApp | undefined;
export const stackServerApp = new StackServerApp({
inheritsFrom: stackClientApp,
});
export function getStackServerApp(): InternalServerApp {
if (!_stackServerApp) {
if (isRemoteDevelopmentEnvironmentEnabled()) {
throw new StackAssertionError("stackServerApp is not available in the local remote development environment dashboard.");
}
_stackServerApp = new StackServerApp({
inheritsFrom: stackClientApp,
});
}
return _stackServerApp;
}

View File

@ -8,7 +8,7 @@ export function registerWhoamiCommand(program: Command) {
.description("Show the currently logged-in Stack Auth CLI user")
.action(async () => {
const flags = program.opts();
const auth = resolveSessionAuth(flags);
const auth = resolveSessionAuth();
const user = await getInternalUser(auth);
const teams = await user.listTeams();