@@ -13,6 +13,7 @@ import { installDependencies } from "@opennextjs/aws/build/installDeps.js";
13
13
import logger from "@opennextjs/aws/logger.js" ;
14
14
import { minifyAll } from "@opennextjs/aws/minimize-js.js" ;
15
15
import { openNextEdgePlugins } from "@opennextjs/aws/plugins/edge.js" ;
16
+ import { openNextExternalMiddlewarePlugin } from "@opennextjs/aws/plugins/externalMiddleware.js" ;
16
17
import { openNextReplacementPlugin } from "@opennextjs/aws/plugins/replacement.js" ;
17
18
import { openNextResolvePlugin } from "@opennextjs/aws/plugins/resolve.js" ;
18
19
import type { FunctionOptions , SplittedFunctionOptions } from "@opennextjs/aws/types/open-next.js" ;
@@ -150,13 +151,13 @@ async function generateBundle(
150
151
buildHelper . copyEnvFile ( appBuildOutputPath , packagePath , outputPath ) ;
151
152
152
153
// Copy all necessary traced files
153
- await copyTracedFiles (
154
- appBuildOutputPath ,
154
+ await copyTracedFiles ( {
155
+ buildOutputPath : appBuildOutputPath ,
155
156
packagePath,
156
- outputPath ,
157
- fnOptions . routes ?? [ "app/page.tsx" ] ,
158
- isBundled
159
- ) ;
157
+ outputDir : outputPath ,
158
+ routes : fnOptions . routes ?? [ "app/page.tsx" ] ,
159
+ bundledNextServer : isBundled ,
160
+ } ) ;
160
161
161
162
// Build Lambda code
162
163
// note: bundle in OpenNext package b/c the adapter relies on the
@@ -198,9 +199,10 @@ async function generateBundle(
198
199
overrides,
199
200
} ) ,
200
201
202
+ openNextExternalMiddlewarePlugin ( path . join ( options . openNextDistDir , "core/edgeFunctionHandler.js" ) ) ,
203
+
201
204
openNextEdgePlugins ( {
202
205
nextDir : path . join ( options . appBuildOutputPath , ".next" ) ,
203
- edgeFunctionHandlerPath : path . join ( options . openNextDistDir , "core" , "edgeFunctionHandler.js" ) ,
204
206
isInCloudfare : true ,
205
207
} ) ,
206
208
] ;
0 commit comments