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) {
3030 // if we have a host and a proto, we can construct the origin
3131 if ( host && proto ) origin = `${ proto } ://${ host } ` ;
3232 } 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." ) ;
3434 }
3535
36- // Fallbacks for requests where headers() is not available
3736 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." ) ;
4738 }
4839
4940 const path = pathname . startsWith ( "/" ) ? pathname : `/${ pathname } ` ;
You can’t perform that action at this time.
0 commit comments