Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions examples/app-router/open-next.config.local.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js";

Check failure on line 1 in examples/app-router/open-next.config.local.ts

View workflow job for this annotation

GitHub Actions / validate

format

File content differs from formatting output

export default {
default: {
override: {
wrapper: "express-dev",
converter: "node",
incrementalCache: "fs-dev",
queue: "direct",
tagCache: "dummy",
},
},

imageOptimization: {
override: {
wrapper: "dummy",
converter: "dummy",
},
loader: "fs-dev",
},

// You can override the build command here so that you don't have to rebuild next every time you make a change
//buildCommand: "echo 'No build command'",
} satisfies OpenNextConfig;
3 changes: 2 additions & 1 deletion examples/app-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.1.24",
"private": true,
"scripts": {
"openbuild": "node ../../packages/open-next/dist/index.js build --streaming --build-command \"npx turbo build\"",
"openbuild": "node ../../packages/open-next/dist/index.js build",
"openbuild:local": "node ../../packages/open-next/dist/index.js build --config-path open-next.config.local.ts",
"dev": "next dev --turbopack --port 3001",
"build": "next build",
"start": "next start --port 3001",
Expand Down
2 changes: 1 addition & 1 deletion examples/app-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{

Check failure on line 1 in examples/app-router/tsconfig.json

View workflow job for this annotation

GitHub Actions / validate

format

File content differs from formatting output
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
Expand All @@ -24,5 +24,5 @@
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "open-next.config.ts", "open-next.config.local.ts"]
}
23 changes: 23 additions & 0 deletions examples/pages-router/open-next.config.local.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

Check failure on line 1 in examples/pages-router/open-next.config.local.ts

View workflow job for this annotation

GitHub Actions / validate

format

File content differs from formatting output
export default {
default: {
override: {
wrapper: "express-dev",
converter: "node",
incrementalCache: "fs-dev",
queue: "direct",
tagCache: "dummy",
},
},

imageOptimization: {
override: {
wrapper: "dummy",
converter: "dummy",
},
loader: "fs-dev",
},

// You can override the build command here so that you don't have to rebuild next every time you make a change
//buildCommand: "echo 'No build command'",
};
1 change: 1 addition & 0 deletions examples/pages-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"scripts": {
"openbuild": "node ../../packages/open-next/dist/index.js build --build-command \"npx turbo build\"",
"openbuild:local": "node ../../packages/open-next/dist/index.js build --config-path open-next.config.local.ts",
"dev": "next dev --turbopack --port 3002",
"build": "next build",
"start": "next start --port 3002",
Expand Down
7 changes: 7 additions & 0 deletions packages/open-next/src/core/requestHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AsyncLocalStorage } from "node:async_hooks";

Check failure on line 1 in packages/open-next/src/core/requestHandler.ts

View workflow job for this annotation

GitHub Actions / validate

format

File content differs from formatting output

import type { OpenNextNodeResponse } from "http/index.js";
import { IncomingMessage } from "http/index.js";
Expand All @@ -18,6 +18,7 @@
constructNextUrl,
convertRes,
convertToQuery,
convertToQueryString,
createServerResponse,
} from "./routing/util";
import routingHandler, {
Expand Down Expand Up @@ -266,6 +267,12 @@
//#endOverride

// Next Server
// TODO: only enable this on Next 15.4+
const reqUrl = new URL(routingResult.initialURL);

This comment was marked as outdated.

// We need to set the pathname to the data request path
req.url = reqUrl.pathname + convertToQueryString(routingResult.internalEvent.query);
// We need to set the headers to the request metadata

await requestHandler(requestMetadata)(req, res);
} catch (e: any) {
// This might fail when using bundled next, importing won't do the trick either
Expand Down
Loading
Loading