Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

chore(api): add logs when sdk request fails by auth

Carl-Gerhard Lindesvärd27ee6235840d
diff --git a/apps/api/src/hooks/client.hook.ts b/apps/api/src/hooks/client.hook.ts
index 8f9d5546c..5f6052fa5 100644
--- a/apps/api/src/hooks/client.hook.ts
+++ b/apps/api/src/hooks/client.hook.ts
@@ -18,9 +18,11 @@ export async function clientHook(
req.client = client;
} catch (error) {
if (error instanceof SdkAuthError) {
+ req.log.warn(error, 'Invalid SDK request');
return reply.status(401).send(error.message);
}
+ req.log.error(error, 'Invalid SDK request');
return reply.status(500).send('Internal server error');
}
}