Skip to content

Commit fce7ec3

Browse files
committed
fix: correct server handler code
1 parent c0cc952 commit fce7ec3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/helpers/functions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { nodeFileTrace } from '@vercel/nft'
44
import { copySync, emptyDirSync, readJsonSync, writeJSONSync } from 'fs-extra/esm'
55

66
import { NEXT_BUILD_DIR, SERVER_HANDLER_DIR, SERVER_HANDLER_NAME, PLUGIN_DIR } from './constants.js'
7-
import { write } from 'fs-extra'
87

98
const pkg = readJsonSync(`${PLUGIN_DIR}/package.json`)
109

@@ -48,6 +47,6 @@ export const createServerHandler = async () => {
4847

4948
writeFileSync(
5049
`${SERVER_HANDLER_DIR}/${SERVER_HANDLER_NAME}.js`,
51-
`import handler from './dist/templates/server-handler.js';export default (request) => handler;export const config = { path: '/*' }`,
50+
`import handler from './dist/templates/server-handler.js';export default handler;export const config = { path: '/*' }`,
5251
)
5352
}

src/templates/server-handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { toComputeResponse, toReqRes } from '@fastly/http-compute-js'
2+
import type { WorkerRequestHandler } from 'next/dist/server/lib/types.js'
23

34
import { RUNTIME_DIR } from '../helpers/constants.js'
45

5-
let nextHandler: any
6+
let nextHandler: WorkerRequestHandler
67

78
export default async (request: Request) => {
89
if (!nextHandler) {

0 commit comments

Comments
 (0)