mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
Preserve inherited function durations
This commit is contained in:
parent
2bf5e1e3d0
commit
13d257b905
8
apps/backend/api/config-github-cancel.ts
Normal file
8
apps/backend/api/config-github-cancel.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import app from "../dist/vercel.mjs";
|
||||
|
||||
export const config = {
|
||||
runtime: "nodejs",
|
||||
maxDuration: 60,
|
||||
};
|
||||
|
||||
export default app;
|
||||
@ -1,8 +1,8 @@
|
||||
import app from "../dist/vercel.mjs";
|
||||
|
||||
// Preserve the project-level duration inherited by routes without a pre-Elysia override.
|
||||
export const config = {
|
||||
runtime: "nodejs",
|
||||
maxDuration: 60,
|
||||
};
|
||||
|
||||
export default app;
|
||||
|
||||
@ -2,11 +2,13 @@ import { readFile } from "node:fs/promises";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("Vercel function durations", () => {
|
||||
it("preserves the route-specific limits from the Next.js deployment", async () => {
|
||||
const [vercelJson, applyEntry, commitEntry] = await Promise.all([
|
||||
it("preserves inherited and route-specific limits from the Next.js deployment", async () => {
|
||||
const [vercelJson, defaultEntry, applyEntry, commitEntry, cancelEntry] = await Promise.all([
|
||||
readFile(new URL("../../vercel.json", import.meta.url), "utf8"),
|
||||
readFile(new URL("../../api/index.ts", import.meta.url), "utf8"),
|
||||
readFile(new URL("../../api/config-github-apply.ts", import.meta.url), "utf8"),
|
||||
readFile(new URL("../../api/config-github-commit.ts", import.meta.url), "utf8"),
|
||||
readFile(new URL("../../api/config-github-cancel.ts", import.meta.url), "utf8"),
|
||||
]);
|
||||
|
||||
expect(JSON.parse(vercelJson)).toMatchObject({
|
||||
@ -19,13 +21,19 @@ describe("Vercel function durations", () => {
|
||||
source: "/api/:version/internal/config/github/commit",
|
||||
destination: "/api/config-github-commit",
|
||||
},
|
||||
{
|
||||
source: "/api/:version/internal/config/github/cancel",
|
||||
destination: "/api/config-github-cancel",
|
||||
},
|
||||
{
|
||||
source: "/(.*)",
|
||||
destination: "/api",
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(defaultEntry).not.toContain("maxDuration");
|
||||
expect(applyEntry).toContain("maxDuration: 800");
|
||||
expect(commitEntry).toContain("maxDuration: 120");
|
||||
expect(cancelEntry).toContain("maxDuration: 60");
|
||||
});
|
||||
});
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
"rewrites": [
|
||||
{ "source": "/api/:version/internal/config/github/apply", "destination": "/api/config-github-apply" },
|
||||
{ "source": "/api/:version/internal/config/github/commit", "destination": "/api/config-github-commit" },
|
||||
{ "source": "/api/:version/internal/config/github/cancel", "destination": "/api/config-github-cancel" },
|
||||
{ "source": "/(.*)", "destination": "/api" }
|
||||
],
|
||||
"crons": [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user