File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -40,17 +40,20 @@ export const stagehandConfig: ConstructorParams = {
4040      logLineToString ( message ) 
4141    )  /* Custom logging function to stderr */ , 
4242  domSettleTimeoutMs : 30_000  /* Timeout for DOM to settle in milliseconds */ , 
43-   browserbaseSessionCreateParams : { 
44-     projectId : process . env . BROWSERBASE_PROJECT_ID ! , 
45-     browserSettings : process . env . CONTEXT_ID 
43+   browserbaseSessionCreateParams :
44+     process . env . BROWSERBASE_API_KEY  &&  process . env . BROWSERBASE_PROJECT_ID 
4645      ? { 
47-           context : { 
48-             id : process . env . CONTEXT_ID , 
49-             persist : true , 
50-           } , 
46+           projectId : process . env . BROWSERBASE_PROJECT_ID ! , 
47+           browserSettings : process . env . CONTEXT_ID 
48+             ? { 
49+                 context : { 
50+                   id : process . env . CONTEXT_ID , 
51+                   persist : true , 
52+                 } , 
53+               } 
54+             : undefined , 
5155        } 
5256      : undefined , 
53-   } , 
5457  localBrowserLaunchOptions : process . env . LOCAL_CDP_URL 
5558    ? { 
5659        cdpUrl : process . env . LOCAL_CDP_URL , 
@@ -168,7 +171,11 @@ export function createServer() {
168171          content : [ 
169172            { 
170173              type : "text" , 
171-               text : `Failed to initialize Stagehand: ${ errorMsg }  , 
174+               text : `Failed to initialize Stagehand: ${ errorMsg } ${ JSON . stringify (  
175+                 stagehandConfig ,  
176+                 null ,  
177+                 2  
178+               ) }  `, 
172179            } , 
173180            { 
174181              type : "text" , 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments