Skip to content

Commit 3ec53ee

Browse files
committed
fixup! misc minor
1 parent 85d31dc commit 3ec53ee

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

packages/open-next/src/adapter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from "node:fs";
2+
import { createRequire } from "node:module";
23
import path from "node:path";
3-
import url from "node:url";
44
import type { NextConfig } from "types/next-types";
55
import { compileCache } from "./build/compileCache.js";
66
import { compileOpenNextConfig } from "./build/compileConfig.js";
@@ -55,7 +55,10 @@ export default {
5555
{ nodeExternals: undefined },
5656
);
5757

58-
const openNextDistDir = url.fileURLToPath(new URL(".", import.meta.url));
58+
const require = createRequire(import.meta.url);
59+
const openNextDistDir = path.dirname(
60+
require.resolve("@opennextjs/aws/index.js"),
61+
);
5962

6063
buildOpts = buildHelper.normalizeOptions(config, openNextDistDir, buildDir);
6164

packages/open-next/src/build/compileConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export async function compileOpenNextConfig(
2323
{ nodeExternals = "", compileEdge = false } = {},
2424
) {
2525
const buildDir = fs.mkdtempSync(path.join(os.tmpdir(), "open-next-tmp"));
26+
2627
let configPath = compileOpenNextConfigNode(
2728
openNextConfigPath,
2829
buildDir,

packages/open-next/src/core/routing/adapterHandler.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { IncomingMessage } from "node:http";
22
import { finished } from "node:stream/promises";
3-
// import { AppPathRoutesManifest } from "config/index";
43
import type { OpenNextNodeResponse } from "http/index";
54
import type { ResolvedRoute, RoutingResult, WaitUntil } from "types/open-next";
65

@@ -35,17 +34,15 @@ export async function adapterHandler(
3534
resolved = true;
3635
return result;
3736
//If it doesn't throw, we are done
38-
} catch {
39-
console.log("## adapterHandler route failed", route);
37+
} catch (e) {
38+
console.log("## adapterHandler route failed", route, e);
4039
// I'll have to run some more tests, but in theory, we should not have anything special to do here, and we should return the 500 page here.
4140
}
4241
}
4342
}
4443

4544
// Body replaced at build time
46-
function getHandler(
47-
route: ResolvedRoute,
48-
):
45+
function getHandler(route: ResolvedRoute):
4946
| undefined
5047
| {
5148
handler: (

0 commit comments

Comments
 (0)