Skip to content

Commit

Permalink
fix(batch-exports): Remove zero unicode from error message
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Dec 31, 2024
1 parent 9b81d45 commit 715a22f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions posthog/temporal/batch_exports/batch_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,14 @@ async def finish_batch_export_run(inputs: FinishBatchExportRunInputs) -> None:
for key, value in dataclasses.asdict(inputs).items()
if key not in not_model_params and value is not None
}

latest_error = update_params.get("latest_error", None)
if latest_error is not None and isinstance(latest_error, str):
# NUL (\x00) bytes are not allowed in PostgreSQL, so we replace them from
# the free text field `latest_error`.
latest_error = latest_error.replace("\x00", "")
update_params["latest_error"] = latest_error

batch_export_run = await database_sync_to_async(update_batch_export_run)(
run_id=uuid.UUID(inputs.id),
finished_at=dt.datetime.now(dt.UTC),
Expand Down

0 comments on commit 715a22f

Please sign in to comment.