mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Turbopack for backend
This commit is contained in:
parent
cf0e6b9d63
commit
3e1a901c37
@ -56,10 +56,13 @@ const nextConfig = {
|
||||
poweredByHeader: false,
|
||||
|
||||
experimental: {
|
||||
instrumentationHook: true,
|
||||
serverMinification: false, // needs to be disabled for oidc-provider to work, which relies on the original constructor names
|
||||
},
|
||||
|
||||
serverExternalPackages: [
|
||||
'oidc-provider',
|
||||
],
|
||||
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"typecheck": "tsc --noEmit",
|
||||
"with-env": "dotenv -c development --",
|
||||
"with-env:prod": "dotenv -c --",
|
||||
"dev": "concurrently -n \"dev,codegen,prisma-studio\" -k \"next dev --port 8102\" \"pnpm run codegen:watch\" \"pnpm run prisma-studio\"",
|
||||
"dev": "concurrently -n \"dev,codegen,prisma-studio\" -k \"next dev --turbopack --port 8102\" \"pnpm run codegen:watch\" \"pnpm run prisma-studio\"",
|
||||
"build": "pnpm run codegen && next build",
|
||||
"docker-build": "pnpm run codegen && next build --experimental-build-mode compile",
|
||||
"self-host-seed-script": "tsup --config prisma/tsup.config.ts",
|
||||
@ -85,6 +85,8 @@
|
||||
"prisma": "^6.0.1",
|
||||
"rimraf": "^5.0.5",
|
||||
"tsup": "^8.3.0",
|
||||
"tsx": "^4.7.2"
|
||||
"tsx": "^4.7.2",
|
||||
"require-in-the-middle": "^7.4.0",
|
||||
"import-in-the-middle": "^1.12.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ export async function sendEmail({
|
||||
await trace.getTracer('stackframe').startActiveSpan('sendEmail', async (span) => {
|
||||
try {
|
||||
const transporter = nodemailer.createTransport({
|
||||
logger: true,
|
||||
logger: !emailConfig.username.toLowerCase().includes('inbucket'), // the info is not particularly useful for Inbucket, so we don't log anything
|
||||
host: emailConfig.host,
|
||||
port: emailConfig.port,
|
||||
secure: emailConfig.secure,
|
||||
|
||||
@ -108,7 +108,10 @@ export function handleApiRequest(handler: (req: NextRequest, options: any, reque
|
||||
}
|
||||
|
||||
console.log(`[ ERR] [${requestId}] ${req.method} ${req.url}: ${statusError.message}`);
|
||||
if (!commonErrors.some(e => statusError instanceof e)) {
|
||||
|
||||
// if we're in prod, log some extra info for debugging
|
||||
// probably won't need this in dev, and it only spams the console
|
||||
if (getNodeEnvironment().includes('prod') && !commonErrors.some(e => statusError instanceof e)) {
|
||||
// HACK: Log a nicified version of the error instead of statusError to get around buggy Next.js pretty-printing
|
||||
// https://www.reddit.com/r/nextjs/comments/1gkxdqe/comment/m19kxgn/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
|
||||
console.debug(`For the error above with request ID ${requestId}, the full error is:`, errorToNiceString(statusError));
|
||||
|
||||
@ -96,7 +96,6 @@ export async function niceBackendFetch(url: string | URL, options?: Omit<NiceReq
|
||||
} : {},
|
||||
"x-stack-access-token": userAuth?.accessToken,
|
||||
"x-stack-refresh-token": userAuth?.refreshToken,
|
||||
"x-stack-disable-artificial-development-delay": "yes",
|
||||
...Object.fromEntries(new Headers(filterUndefined(headers ?? {}) as any).entries()),
|
||||
}),
|
||||
});
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { generateSecureRandomString } from "@stackframe/stack-shared/dist/utils/crypto";
|
||||
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
|
||||
import { omit } from "@stackframe/stack-shared/dist/utils/objects";
|
||||
import { filterUndefined, omit } from "@stackframe/stack-shared/dist/utils/objects";
|
||||
import { Nicifiable } from "@stackframe/stack-shared/dist/utils/strings";
|
||||
import { AsyncLocalStorage } from "node:async_hooks";
|
||||
import { randomUUID } from "node:crypto";
|
||||
@ -172,7 +172,13 @@ export async function niceFetch(url: string | URL, options?: NiceRequestInit): P
|
||||
url.searchParams.append(key, value);
|
||||
}
|
||||
}
|
||||
const fetchRes = await fetch(url, options);
|
||||
const fetchRes = await fetch(url, {
|
||||
...options,
|
||||
headers: {
|
||||
"x-stack-disable-artificial-development-delay": "yes",
|
||||
...filterUndefined(options?.headers ?? {}),
|
||||
},
|
||||
});
|
||||
let body;
|
||||
if (fetchRes.headers.get("content-type")?.includes("application/json")) {
|
||||
body = await fetchRes.json();
|
||||
|
||||
@ -1,7 +1,2 @@
|
||||
/** @type {import("next").NextConfig} */
|
||||
module.exports = {
|
||||
webpack(config) {
|
||||
config.experiments = { ...config.experiments, topLevelAwait: true };
|
||||
return config;
|
||||
},
|
||||
};
|
||||
module.exports = {};
|
||||
|
||||
@ -238,9 +238,15 @@ importers:
|
||||
glob:
|
||||
specifier: ^10.4.1
|
||||
version: 10.4.1
|
||||
import-in-the-middle:
|
||||
specifier: ^1.12.0
|
||||
version: 1.12.0
|
||||
prisma:
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.1
|
||||
require-in-the-middle:
|
||||
specifier: ^7.4.0
|
||||
version: 7.4.0
|
||||
rimraf:
|
||||
specifier: ^5.0.5
|
||||
version: 5.0.7
|
||||
@ -7654,11 +7660,8 @@ packages:
|
||||
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
import-in-the-middle@1.11.0:
|
||||
resolution: {integrity: sha512-5DimNQGoe0pLUHbR9qK84iWaWjjbsxiqXnw6Qz64+azRgleqv9k2kTt5fw7QsOpmaGYtuxxursnPPsnTKEx10Q==}
|
||||
|
||||
import-in-the-middle@1.11.2:
|
||||
resolution: {integrity: sha512-gK6Rr6EykBcc6cVWRSBR5TWf8nn6hZMYSRYqCcHa0l0d1fPK7JSYo6+Mlmck76jIX9aL/IZ71c06U2VpFwl1zA==}
|
||||
import-in-the-middle@1.12.0:
|
||||
resolution: {integrity: sha512-yAgSE7GmtRcu4ZUSFX/4v69UGXwugFFSdIQJ14LHPOPPQrWv8Y7O9PHsw8Ovk7bKCLe4sjXMbZFqGFcLHpZ89w==}
|
||||
|
||||
imurmurhash@0.1.4:
|
||||
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
|
||||
@ -11294,7 +11297,7 @@ snapshots:
|
||||
'@babel/helper-split-export-declaration': 7.24.7
|
||||
'@babel/parser': 7.24.7
|
||||
'@babel/types': 7.24.7
|
||||
debug: 4.3.5
|
||||
debug: 4.3.7
|
||||
globals: 11.12.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@ -13039,7 +13042,7 @@ snapshots:
|
||||
'@opentelemetry/api': 1.9.0
|
||||
'@opentelemetry/api-logs': 0.52.1
|
||||
'@types/shimmer': 1.2.0
|
||||
import-in-the-middle: 1.11.2
|
||||
import-in-the-middle: 1.12.0
|
||||
require-in-the-middle: 7.4.0
|
||||
semver: 7.6.3
|
||||
shimmer: 1.2.1
|
||||
@ -13051,7 +13054,7 @@ snapshots:
|
||||
'@opentelemetry/api': 1.9.0
|
||||
'@opentelemetry/api-logs': 0.53.0
|
||||
'@types/shimmer': 1.2.0
|
||||
import-in-the-middle: 1.11.0
|
||||
import-in-the-middle: 1.12.0
|
||||
require-in-the-middle: 7.4.0
|
||||
semver: 7.6.3
|
||||
shimmer: 1.2.1
|
||||
@ -13063,7 +13066,7 @@ snapshots:
|
||||
'@opentelemetry/api': 1.9.0
|
||||
'@opentelemetry/api-logs': 0.54.2
|
||||
'@types/shimmer': 1.2.0
|
||||
import-in-the-middle: 1.11.2
|
||||
import-in-the-middle: 1.12.0
|
||||
require-in-the-middle: 7.4.0
|
||||
semver: 7.6.3
|
||||
shimmer: 1.2.1
|
||||
@ -14832,7 +14835,7 @@ snapshots:
|
||||
'@sentry/core': 8.40.0
|
||||
'@sentry/opentelemetry': 8.40.0(@opentelemetry/api@1.9.0)(@opentelemetry/core@1.26.0(@opentelemetry/api@1.9.0))(@opentelemetry/instrumentation@0.54.2(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@1.26.0(@opentelemetry/api@1.9.0))(@opentelemetry/semantic-conventions@1.27.0)
|
||||
'@sentry/types': 8.40.0
|
||||
import-in-the-middle: 1.11.2
|
||||
import-in-the-middle: 1.12.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@ -15641,10 +15644,6 @@ snapshots:
|
||||
mime-types: 2.1.35
|
||||
negotiator: 0.6.3
|
||||
|
||||
acorn-import-attributes@1.9.5(acorn@8.12.0):
|
||||
dependencies:
|
||||
acorn: 8.12.0
|
||||
|
||||
acorn-import-attributes@1.9.5(acorn@8.14.0):
|
||||
dependencies:
|
||||
acorn: 8.14.0
|
||||
@ -15653,6 +15652,10 @@ snapshots:
|
||||
dependencies:
|
||||
acorn: 8.12.0
|
||||
|
||||
acorn-jsx@5.3.2(acorn@8.14.0):
|
||||
dependencies:
|
||||
acorn: 8.14.0
|
||||
|
||||
acorn-walk@8.3.4:
|
||||
dependencies:
|
||||
acorn: 8.14.0
|
||||
@ -18178,14 +18181,7 @@ snapshots:
|
||||
parent-module: 1.0.1
|
||||
resolve-from: 4.0.0
|
||||
|
||||
import-in-the-middle@1.11.0:
|
||||
dependencies:
|
||||
acorn: 8.12.0
|
||||
acorn-import-attributes: 1.9.5(acorn@8.12.0)
|
||||
cjs-module-lexer: 1.4.0
|
||||
module-details-from-path: 1.0.3
|
||||
|
||||
import-in-the-middle@1.11.2:
|
||||
import-in-the-middle@1.12.0:
|
||||
dependencies:
|
||||
acorn: 8.14.0
|
||||
acorn-import-attributes: 1.9.5(acorn@8.14.0)
|
||||
@ -19087,8 +19083,8 @@ snapshots:
|
||||
|
||||
micromark-extension-mdxjs@3.0.0:
|
||||
dependencies:
|
||||
acorn: 8.12.0
|
||||
acorn-jsx: 5.3.2(acorn@8.12.0)
|
||||
acorn: 8.14.0
|
||||
acorn-jsx: 5.3.2(acorn@8.14.0)
|
||||
micromark-extension-mdx-expression: 3.0.0
|
||||
micromark-extension-mdx-jsx: 3.0.0
|
||||
micromark-extension-mdx-md: 2.0.0
|
||||
@ -20594,7 +20590,7 @@ snapshots:
|
||||
|
||||
require-in-the-middle@7.4.0:
|
||||
dependencies:
|
||||
debug: 4.3.5
|
||||
debug: 4.3.7
|
||||
module-details-from-path: 1.0.3
|
||||
resolve: 1.22.8
|
||||
transitivePeerDependencies:
|
||||
@ -22124,8 +22120,8 @@ snapshots:
|
||||
'@webassemblyjs/ast': 1.12.1
|
||||
'@webassemblyjs/wasm-edit': 1.12.1
|
||||
'@webassemblyjs/wasm-parser': 1.12.1
|
||||
acorn: 8.12.0
|
||||
acorn-import-attributes: 1.9.5(acorn@8.12.0)
|
||||
acorn: 8.14.0
|
||||
acorn-import-attributes: 1.9.5(acorn@8.14.0)
|
||||
browserslist: 4.24.2
|
||||
chrome-trace-event: 1.0.4
|
||||
enhanced-resolve: 5.17.0
|
||||
@ -22155,8 +22151,8 @@ snapshots:
|
||||
'@webassemblyjs/ast': 1.12.1
|
||||
'@webassemblyjs/wasm-edit': 1.12.1
|
||||
'@webassemblyjs/wasm-parser': 1.12.1
|
||||
acorn: 8.12.0
|
||||
acorn-import-attributes: 1.9.5(acorn@8.12.0)
|
||||
acorn: 8.14.0
|
||||
acorn-import-attributes: 1.9.5(acorn@8.14.0)
|
||||
browserslist: 4.24.2
|
||||
chrome-trace-event: 1.0.4
|
||||
enhanced-resolve: 5.17.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user