fix(langfuse): validate public key independently

This commit is contained in:
Ravi Kumar L 2026-07-28 23:58:41 +02:00
parent 5dd47ae62a
commit 2df92580bc
2 changed files with 4 additions and 4 deletions

View file

@ -514,9 +514,8 @@ describe('createAdminLangfuseHandlers', () => {
const [publicUrl, publicInit] = (global.fetch as unknown as jest.Mock).mock.calls[1];
expect(publicUrl).toBe('https://cloud.langfuse.com/api/public/ingestion');
expect(publicInit.method).toBe('POST');
expect(
Buffer.from(publicInit.headers.Authorization.replace('Basic ', ''), 'base64').toString(),
).toBe('pk:sk');
expect(publicInit.headers.Authorization).toBe('Bearer pk');
expect(publicInit.headers['X-Langfuse-Public-Key']).toBe('pk');
expect(publicInit.headers['Content-Type']).toBe('application/json');
expect(JSON.parse(publicInit.body)).toEqual({ batch: [] });
expect(publicInit.signal).toBe(init.signal);

View file

@ -118,7 +118,8 @@ async function verifyLangfuseCredentials(
const publicResponse = await fetch(`${destination.baseUrl}/api/public/ingestion`, {
method: 'POST',
headers: {
Authorization: `Basic ${auth}`,
Authorization: `Bearer ${publicKey}`,
'X-Langfuse-Public-Key': publicKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({ batch: [] }),