mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Resolve apiUrl from the request via getApiUrlForRequest, and thread apiUrl into createAuthTokens. the 500 after merging dev was token signing now need an apiUrl for the JWT iss claim. I wasnt passing it until merge dev into
This commit is contained in:
parent
acf292c79e
commit
c3f665bc2b
@ -1,4 +1,5 @@
|
||||
import { claimPreviewPoolLease, fillPreviewPool } from "@/lib/preview-pool";
|
||||
import { getApiUrlForRequest } from "@/lib/request-api-url";
|
||||
import { createSmartRouteHandler } from "@/route-handlers/smart-route-handler";
|
||||
import { runAsynchronouslyAndWaitUntil } from "@/utils/background-tasks";
|
||||
import { yupNumber, yupObject, yupString } from "@stackframe/stack-shared/dist/schema-fields";
|
||||
@ -25,8 +26,8 @@ export const POST = createSmartRouteHandler({
|
||||
refresh_token: yupString().defined(),
|
||||
}).defined(),
|
||||
}),
|
||||
async handler() {
|
||||
const lease = await claimPreviewPoolLease();
|
||||
async handler(_req, fullReq) {
|
||||
const lease = await claimPreviewPoolLease({ apiUrl: getApiUrlForRequest(fullReq) });
|
||||
runAsynchronouslyAndWaitUntil(fillPreviewPool({ maxCreate: 1 }));
|
||||
|
||||
return {
|
||||
|
||||
@ -532,7 +532,7 @@ export async function fillPreviewPool(options?: { maxCreate?: number }): Promise
|
||||
};
|
||||
}
|
||||
|
||||
export async function claimPreviewPoolLease(): Promise<PreviewPoolLease> {
|
||||
export async function claimPreviewPoolLease(options: { apiUrl: string }): Promise<PreviewPoolLease> {
|
||||
assertPreviewModeEnabled();
|
||||
|
||||
const claimed = await claimReadyPreviewPoolProject() ?? await createPreviewPoolProject("leased");
|
||||
@ -542,6 +542,7 @@ export async function claimPreviewPoolLease(): Promise<PreviewPoolLease> {
|
||||
const { accessToken, refreshToken } = await createAuthTokens({
|
||||
tenancy: internalTenancy,
|
||||
projectUserId: claimed.userId,
|
||||
apiUrl: options.apiUrl,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user