diff --git a/integration-test/langfuse-openai.spec.ts b/integration-test/langfuse-openai.spec.ts index 5ca4bac7..0207c631 100644 --- a/integration-test/langfuse-openai.spec.ts +++ b/integration-test/langfuse-openai.spec.ts @@ -981,7 +981,7 @@ describe("Langfuse-OpenAI-Integation", () => { expect(messages).toBeDefined(); await client.flushAsync(); - }, 10000); + }, 20_000); it("should work with structured output parsing with response_format", async () => { const traceId = randomUUID(); diff --git a/langfuse-core/src/index.ts b/langfuse-core/src/index.ts index 41415227..c548833d 100644 --- a/langfuse-core/src/index.ts +++ b/langfuse-core/src/index.ts @@ -594,7 +594,8 @@ abstract class LangfuseCoreStateless { try { JSON.stringify(finalEventBody); } catch (e) { - throw Error(`[Langfuse SDK] Event Body for ${type} is not JSON-serializable: ${e}`); + this._events.emit("error", `[Langfuse SDK] Event Body for ${type} is not JSON-serializable: ${e}`); + return; } const queue = this.getPersistedProperty(LangfusePersistedProperty.Queue) || [];