mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Force dynamic
This commit is contained in:
parent
89b00bb352
commit
496f6e459b
@ -2,9 +2,12 @@ import { handleApiRequest } from "@/route-handlers/smart-route-handler";
|
||||
import { getEnvVariable } from "@stackframe/stack-shared/dist/utils/env";
|
||||
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
|
||||
import { createNodeHttpServerDuplex } from "@stackframe/stack-shared/dist/utils/node-http";
|
||||
import { cookies } from "next/headers";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { createOidcProvider } from "./idp";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const pathPrefix = "/api/v1/integrations/neon/oauth/idp";
|
||||
|
||||
// we want to initialize the OIDC provider lazily so it's not initiated at build time
|
||||
@ -25,6 +28,9 @@ function getOidcCallbackPromise() {
|
||||
}
|
||||
|
||||
const handler = handleApiRequest(async (req: NextRequest) => {
|
||||
// force dynamic
|
||||
cookies();
|
||||
|
||||
const newUrl = req.url.replace(pathPrefix, "");
|
||||
if (newUrl === req.url) {
|
||||
throw new StackAssertionError("No path prefix found in request URL. Is the pathPrefix correct?", { newUrl, url: req.url, pathPrefix });
|
||||
|
||||
@ -27,7 +27,7 @@ export async function createNodeHttpServerDuplex(options: {
|
||||
// and https://github.com/nodejs/node/blob/main/lib/_http_common.js (particularly the `parserXyz` functions)
|
||||
|
||||
const incomingMessage = new IncomingMessage({
|
||||
encrypted: options.originalUrl?.protocol === "https:",
|
||||
encrypted: options.originalUrl?.protocol === "https:", // trick frameworks into believing this is an HTTPS request
|
||||
} as any);
|
||||
incomingMessage.httpVersionMajor = 1;
|
||||
incomingMessage.httpVersionMinor = 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user