Skip to content

Commit 39775f2

Browse files
committed
fix: add more debug logging to TS e2e tests, disable streaming
1 parent 3e8a191 commit 39775f2

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

e2e_tests/typescript/src/chat_session.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ export class ChatSession {
2727
logger.info(`Agent invocation completed in ${duration}ms`);
2828
} catch (error) {
2929
const duration = Date.now() - startTime;
30-
logger.error(`Agent invocation failed after ${duration}ms:`, error);
30+
logger.error(`Agent invocation failed after ${duration}ms: ${error}`);
31+
if (error instanceof Error) {
32+
logger.error(`Error name: ${error.name}`);
33+
logger.error(`Error message: ${error.message}`);
34+
if (error.stack) {
35+
logger.error(`Error stack: ${error.stack}`);
36+
}
37+
if ('cause' in error && error.cause) {
38+
logger.error(`Error cause: ${JSON.stringify(error.cause, null, 2)}`);
39+
}
40+
}
3141
throw error;
3242
}
3343
}

e2e_tests/typescript/src/main.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,15 @@ async function main(): Promise<void> {
6161
logger.info(`Loaded ${userUtterances.length} test questions`);
6262

6363
logger.info("Initializing Bedrock model...");
64+
const region = typeof config.bedrockClient.config.region === 'function'
65+
? await config.bedrockClient.config.region()
66+
: config.bedrockClient.config.region;
6467
const model = new BedrockModel({
65-
region: config.bedrockClient.config.region as string,
68+
region: region as string,
6669
modelId: config.modelId,
70+
stream: false,
6771
});
68-
logger.info(`Using model: ${config.modelId} in region: ${config.bedrockClient.config.region}`);
72+
logger.info(`Using model: ${config.modelId} in region: ${region} (streaming disabled)`);
6973

7074
logger.info("Creating agent...");
7175
const agent = new Agent({
@@ -89,8 +93,15 @@ process.on("unhandledRejection", (reason, promise) => {
8993

9094
main().catch((error) => {
9195
logger.error("Error in main:", error);
92-
if (error.stack) {
93-
logger.error("Stack trace:", error.stack);
96+
if (error instanceof Error) {
97+
logger.error(`Error type: ${error.constructor.name}`);
98+
logger.error(`Error message: ${error.message}`);
99+
if (error.stack) {
100+
logger.error("Stack trace:", error.stack);
101+
}
102+
if ('cause' in error && error.cause) {
103+
logger.error("Error cause:", JSON.stringify(error.cause, null, 2));
104+
}
94105
}
95106
process.exit(1);
96107
});

e2e_tests/typescript/src/mcp_clients.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function createStdioClient(name: string, config: any): Promise<McpC
2424
args: config.args,
2525
env: config.env ? { ...process.env, ...config.env } : undefined,
2626
});
27-
return new McpClient({ transport });
27+
return new McpClient({ transport, applicationName: name });
2828
}
2929

3030
export async function createLambdaFunctionClient(name: string, config: any): Promise<McpClient> {
@@ -34,7 +34,7 @@ export async function createLambdaFunctionClient(name: string, config: any): Pro
3434
functionName: config.functionName,
3535
regionName: config.region,
3636
});
37-
return new McpClient({ transport });
37+
return new McpClient({ transport, applicationName: name });
3838
}
3939

4040
export async function createLambdaFunctionUrlClient(name: string, config: any): Promise<McpClient> {
@@ -54,7 +54,7 @@ export async function createLambdaFunctionUrlClient(name: string, config: any):
5454

5555
logger.debug(`Lambda function URL: ${functionUrl}, region: ${region}`);
5656
const transport = new StreamableHTTPClientWithSigV4Transport(new URL(functionUrl), { region, service: "lambda" });
57-
return new McpClient({ transport });
57+
return new McpClient({ transport, applicationName: name });
5858
}
5959

6060
export async function createAutomatedOAuthClient(name: string, config: any): Promise<McpClient> {
@@ -86,7 +86,7 @@ export async function createAutomatedOAuthClient(name: string, config: any): Pro
8686
logger.debug(`Creating OAuth transport for ${name}...`);
8787
const transport = await createAutomatedOAuthTransport(serverUrl, clientId, clientSecret);
8888

89-
return new McpClient({ transport });
89+
return new McpClient({ transport, applicationName: name });
9090
}
9191

9292
async function getCloudFormationOutput(stackName: string, outputKey: string, region: string): Promise<string> {

examples/chatbots/typescript/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ async function main(): Promise<void> {
4444
const model = new BedrockModel({
4545
region: config.bedrockClient.config.region as string,
4646
modelId: config.modelId,
47+
stream: false,
4748
});
4849

4950
const agent = new Agent({

0 commit comments

Comments
 (0)