File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -30,20 +30,11 @@ export async function absoluteUrl(pathname: string) {
30
30
// if we have a host and a proto, we can construct the origin
31
31
if ( host && proto ) origin = `${ proto } ://${ host } ` ;
32
32
} catch {
33
- // headers() is unavailable
33
+ throw new Error ( "Headers are not available in this context. Please check where are you calling this function from." ) ;
34
34
}
35
35
36
- // Fallbacks for requests where headers() is not available
37
36
if ( ! origin ) {
38
- if ( IS_PRODUCTION_SERVER ) {
39
- const productionUrl = demand ( "VERCEL_PROJECT_PRODUCTION_URL" ) ;
40
- origin = `https://${ productionUrl } ` ;
41
- } else if ( IS_PREVIEW_SERVER ) {
42
- const previewUrl = demand ( "VERCEL_URL" ) ;
43
- origin = `https://${ previewUrl } ` ;
44
- } else {
45
- origin = "http://localhost:3003" ;
46
- }
37
+ throw new Error ( "No origin found! This should never happen." ) ;
47
38
}
48
39
49
40
const path = pathname . startsWith ( "/" ) ? pathname : `/${ pathname } ` ;
You can’t perform that action at this time.
0 commit comments