@@ -9,17 +9,17 @@ import {
99} from "@aws-sdk/client-apigatewayv2" ;
1010import { checkHasUsers , createAdminUser } from "./users.js" ;
1111
12- const exec = ( command , options = { } ) => {
12+ const exec = ( command , options = { } , prefix = "" ) => {
1313 const child = child_process . exec ( command , {
1414 ...options ,
1515 env : { ...process . env , ...( options . env || { } ) } ,
1616 } ) ;
1717
1818 child . stdout ?. on ( "data" , function ( data ) {
19- console . log ( data ?. trim ( ) ) ;
19+ console . log ( prefix + data ?. trim ( ) ) ;
2020 } ) ;
2121 child . stderr ?. on ( "data" , function ( data ) {
22- console . error ( data ?. trim ( ) ) ;
22+ console . error ( prefix + data ?. trim ( ) ) ;
2323 } ) ;
2424
2525 return new Promise ( ( resolve , reject ) => {
@@ -85,6 +85,8 @@ const deploy = async (answers) => {
8585 console . log ( chalk . blue ( "Deploying..." ) ) ;
8686 await exec ( "yarn deploy" , { cwd : tmpPath } ) ;
8787
88+ const endpoint = await getApiEndpoint ( ) ;
89+
8890 // Create user
8991 let adminPassword ;
9092 if ( await checkHasUsers ( ) ) {
@@ -96,14 +98,7 @@ const deploy = async (answers) => {
9698
9799 // Run auto-trace
98100 console . log ( chalk . blue ( "Auto tracing lambdas..." ) ) ;
99- const endpoint = await getApiEndpoint ( ) ;
100- try {
101- await fetch ( `https://${ endpoint } /api/auto-trace` , {
102- method : "POST" ,
103- headers : { "Content-Type" : "application/json" } ,
104- body : JSON . stringify ( { token : answers . tracerToken } ) ,
105- } ) ;
106- } catch ( e ) { }
101+ await exec ( "yarn auto-trace" , { cwd : tmpPath } , " " ) ;
107102
108103 return { endpoint, adminPassword } ;
109104} ;
0 commit comments