fix(langfuse-exporter): update langfuse sdk to handle non-JSON error responses#1110
Conversation
🦋 Changeset detectedLatest commit: 36850c1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughThe PR updates the langfuse dependency from ^3.37.2 to ^3.38.6 in the langfuse-exporter package to fix a bug where non-JSON error responses caused parsing failures during export retry operations. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.changeset/fuzzy-turkeys-smell.md (1)
5-5: Add a regression test reference for#670.This note captures the dependency update, but it would be safer to also add/track a regression test that simulates non-JSON Langfuse error bodies so this behavior doesn’t regress silently.
I can draft a focused Vitest test case for the exporter path that reproduces
#670if you want.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.changeset/fuzzy-turkeys-smell.md at line 5, Add a Vitest regression test for the langfuse-exporter that simulates Langfuse returning non-JSON error bodies during the exporter retry path: create a test (e.g., tests/langfuse-exporter/non-json-error-regression.test.ts) that invokes the exporter entrypoint function responsible for sending batches (the export/sendBatch/exportWithRetries function used by the langfuse-exporter) and mock the HTTP client to return a 5xx response with a plain-text/non-JSON body on the first attempts and a success or final failure afterward; assert the code does not throw unhandled parsing exceptions, that retry logic still runs, and that the exported result/error is handled as expected to prevent regression for `#670`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.changeset/fuzzy-turkeys-smell.md:
- Line 5: Add a Vitest regression test for the langfuse-exporter that simulates
Langfuse returning non-JSON error bodies during the exporter retry path: create
a test (e.g., tests/langfuse-exporter/non-json-error-regression.test.ts) that
invokes the exporter entrypoint function responsible for sending batches (the
export/sendBatch/exportWithRetries function used by the langfuse-exporter) and
mock the HTTP client to return a 5xx response with a plain-text/non-JSON body on
the first attempts and a success or final failure afterward; assert the code
does not throw unhandled parsing exceptions, that retry logic still runs, and
that the exported result/error is handled as expected to prevent regression for
`#670`.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
.changeset/fuzzy-turkeys-smell.mdpackages/langfuse-exporter/package.json
Fixes #670
Summary
langfusein@voltagent/langfuse-exporterfrom^3.37.2to^3.38.6Why
Issue #670 reports
SyntaxError: Failed to parse JSONfrom the Langfuse SDK on non-JSON error responses during export calls. This updates to the latest 3.x patch level with upstream handling improvements.Validation
pnpm --filter @voltagent/langfuse-exporter lintpnpm --filter @voltagent/langfuse-exporter testpnpm --filter @voltagent/langfuse-exporter buildSummary by cubic
Update langfuse-exporter to use Langfuse ^3.38.6 so non-JSON error responses during export retries are handled correctly. Adds a changeset for a patch release; fixes #670.
Written for commit 36850c1. Summary will update on new commits.
Summary by CodeRabbit