File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export function TRPCReactProvider(props: { children: React.ReactNode }) {
51
51
} ) ,
52
52
httpBatchStreamLink ( {
53
53
transformer : SuperJSON ,
54
- url : getBaseUrl ( ) + " /api/trpc" ,
54
+ url : ` ${ getBaseUrl ( ) } /api/trpc` ,
55
55
headers : ( ) => {
56
56
const headers = new Headers ( ) ;
57
57
headers . set ( "x-trpc-source" , "nextjs-react" ) ;
@@ -73,6 +73,10 @@ export function TRPCReactProvider(props: { children: React.ReactNode }) {
73
73
74
74
function getBaseUrl ( ) {
75
75
if ( typeof window !== "undefined" ) return window . location . origin ;
76
- if ( process . env . VERCEL_URL ) return `https://${ process . env . VERCEL_URL } ` ;
76
+ if ( process . env . VERCEL_URL ) {
77
+ if ( process . env . VERCEL_ENV === "production" )
78
+ return `https://${ process . env . NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL } ` ;
79
+ return `https://${ process . env . VERCEL_URL } ` ;
80
+ }
77
81
return `http://localhost:${ process . env . PORT ?? 3000 } ` ;
78
82
}
You can’t perform that action at this time.
0 commit comments