File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
packages/open-next/src/core Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @opennextjs/aws " : patch
3
+ ---
4
+
5
+ fix: fix basePath support for API routes
Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ const optionalBasepathPrefixRegex = !!RoutesManifest.basePath
34
34
? `^${ RoutesManifest . basePath } /?`
35
35
: "^/" ;
36
36
37
+ // Add the basePath prefix to the api routes
38
+ const apiPrefix = ! ! RoutesManifest . basePath
39
+ ? `${ RoutesManifest . basePath } /api`
40
+ : "/api" ;
41
+
37
42
const staticRegexp = RoutesManifest . routes . static . map (
38
43
( route ) =>
39
44
new RegExp (
@@ -145,8 +150,8 @@ export default async function routingHandler(
145
150
// /api even if it's a page route doesn't get generated in the manifest
146
151
// Ideally we would need to properly check api routes here
147
152
const isApiRoute =
148
- internalEvent . rawPath === "/api" ||
149
- internalEvent . rawPath . startsWith ( "/api/" ) ;
153
+ internalEvent . rawPath === apiPrefix ||
154
+ internalEvent . rawPath . startsWith ( ` ${ apiPrefix } /` ) ;
150
155
151
156
const isNextImageRoute = internalEvent . rawPath . startsWith ( "/_next/image" ) ;
152
157
You can’t perform that action at this time.
0 commit comments