File tree 2 files changed +10
-2
lines changed
packages/open-next/src/overrides/converters
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @opennextjs/aws " : patch
3
+ ---
4
+
5
+ fix: remove leading forward slashes from url in node converter
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type { Converter } from "types/overrides";
6
6
import { extractHostFromHeaders , getQueryFromSearchParams } from "./utils.js" ;
7
7
8
8
const converter : Converter = {
9
- convertFrom : async ( req : IncomingMessage ) => {
9
+ convertFrom : async ( req : IncomingMessage & { protocol ?: string } ) => {
10
10
const body = await new Promise < Buffer > ( ( resolve ) => {
11
11
const chunks : Uint8Array [ ] = [ ] ;
12
12
req . on ( "data" , ( chunk ) => {
@@ -25,7 +25,10 @@ const converter: Converter = {
25
25
] )
26
26
. filter ( ( [ key ] ) => key ) ,
27
27
) ;
28
- const url = new URL ( req . url ! , `http://${ extractHostFromHeaders ( headers ) } ` ) ;
28
+ // https://nodejs.org/api/http.html#messageurl
29
+ const url = new URL (
30
+ `${ req . protocol ? req . protocol : "http" } ://${ extractHostFromHeaders ( headers ) } ${ req . url } ` ,
31
+ ) ;
29
32
const query = getQueryFromSearchParams ( url . searchParams ) ;
30
33
return {
31
34
type : "core" ,
You can’t perform that action at this time.
0 commit comments