H
Hono9mo ago
Blankeos

Proper error logging and tracing?

Do you guys have an example repo that properly sets up error logs and trace? It seems too difficult to trace here (in the image). As you can see it only traces back to the library-code that threw the error. I kinda have to to manually trace which function actually threw that error in my code. Which was around here:
// src/server/s3.ts
export async function transferFileFromTempToPermanent(uniqueId: string) {
const oldKey = `temp/${uniqueId}`;
const newKey = `permanent/${uniqueId}`;

// Copy the object to the new location.
await s3Client.send(
new CopyObjectCommand({
Bucket: privateConfig.s3.BUCKET_NAME,
CopySource: `${privateConfig.s3.BUCKET_NAME}/${oldKey}`,
Key: newKey,
})
);

// Delete from old location.
await s3Client.send(
new DeleteObjectCommand({
Bucket: privateConfig.s3.BUCKET_NAME,
Key: oldKey,
})
);
// src/server/s3.ts
export async function transferFileFromTempToPermanent(uniqueId: string) {
const oldKey = `temp/${uniqueId}`;
const newKey = `permanent/${uniqueId}`;

// Copy the object to the new location.
await s3Client.send(
new CopyObjectCommand({
Bucket: privateConfig.s3.BUCKET_NAME,
CopySource: `${privateConfig.s3.BUCKET_NAME}/${oldKey}`,
Key: newKey,
})
);

// Delete from old location.
await s3Client.send(
new DeleteObjectCommand({
Bucket: privateConfig.s3.BUCKET_NAME,
Key: oldKey,
})
);
1 Reply
Blankeos
BlankeosOP9mo ago
If you look at the logs, it doesn't have s3.ts anywhere D:

Did you find this page helpful?