Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(error-tracking): offer a presigned PUT for symbol set uploads (#106848)

Hugues Pouillot13ccb62b1066
diff --git a/posthog/storage/object_storage.py b/posthog/storage/object_storage.py
index 28853c331aaf..79cc1378cfdc 100644
--- a/posthog/storage/object_storage.py
+++ b/posthog/storage/object_storage.py
@@ -52,6 +52,12 @@ class ObjectStorageClient(metaclass=abc.ABCMeta):
) -> Optional[dict]:
pass
+ @abc.abstractmethod
+ def get_presigned_put(
+ self, bucket: str, file_key: str, content_length: Optional[int] = None, expiration: int = 3600
+ ) -> Optional[str]:
+ pass
+
@abc.abstractmethod
def list_objects(self, bucket: str, prefix: str) -> Optional[list[str]]:
pass
@@ -129,6 +135,11 @@ class UnavailableStorage(ObjectStorageClient):
) -> Optional[dict]:
pass
+ def get_presigned_put(
+ self, bucket: str, file_key: str, content_length: Optional[int] = None, expiration: int = 3600
+ ) -> Optional[str]:
+ pass
+
def list_objects(self, bucket: str, prefix: str) -> Optional[list[str]]:
pass
@@ -238,6 +249,27 @@ class ObjectStorage(ObjectStorageClient):
capture_exception(e)
return None
+ def get_presigned_put(
+ self, bucket: str, file_key: str, content_length: Optional[int] = None, expiration: int = 3600
+ ) -> Optional[str]:
+ try:
+ params: dict[str, Any] = {"Bucket": bucket, "Key": file_key}
+ if content_length is not None:
+ # Signing `content-length` puts it in the SigV4 canonical request, so storage
+ # refuses a body of any other size. It is exact, not a range like a POST policy's
+ # `content-length-range`, so the caller must know the byte count up front.
+ params["ContentLength"] = content_length
+ return self.presigned_client.generate_presigned_url(
+ ClientMethod="put_object",
+ Params=params,
+ ExpiresIn=expiration,
+ HttpMethod="PUT",
+ )
+ except Exception as e:
+ logger.exception("object_storage.get_presigned_put_failed", file_name=file_key, error=e)
+ capture_exception(e)
+ return None
+
def list_objects(self, bucket: str, prefix: str) -> Optional[list[str]]:
try:
s3_response = self.aws_client.list_objects_v2(Bucket=bucket, Prefix=prefix)
@@ -604,6 +636,15 @@ def get_presigned_post(file_key: str, conditions: list[Any], expiration: int = 3
)
+def get_presigned_put(file_key: str, content_length: Optional[int] = None, expiration: int = 3600) -> Optional[str]:
+ return object_storage_client().get_presigned_put(
+ bucket=settings.OBJECT_STORAGE_BUCKET,
+ file_key=file_key,
+ content_length=content_length,
+ expiration=expiration,
+ )
+
+
_accelerated_presigned_client: Optional[Any] = None
_accelerated_client_lock = threading.Lock()
@@ -643,6 +684,23 @@ class PresignedPostPair:
fallback: Optional[dict]
+@frozen
+class PresignedPutPair:
+ """Presigned PUTs for one upload.
+
+ Mirrors ``PresignedPostPair``: the primary targets the transfer-acceleration endpoint when
+ it is configured and presigning succeeds, and the fallback then targets the standard
+ endpoint. Unlike a POST policy, a PUT carries no ``content-length-range``, so a caller that
+ needs the size enforced passes ``content_length`` and storage signs that exact value.
+
+ Cloudflare R2 and other S3-compatible stores implement presigned PUT but not presigned POST,
+ so this is the only upload form that works everywhere.
+ """
+
+ primary: Optional[str]
+ fallback: Optional[str]
+
+
def get_presigned_post_pair(file_key: str, conditions: list[Any], expiration: int = 3600) -> PresignedPostPair:
accelerated = _get_accelerated_presigned_client()
if accelerated:
@@ -663,6 +721,34 @@ def get_presigned_post_pair(file_key: str, conditions: list[Any], expiration: in
)
+def get_presigned_put_pair(
+ file_key: str, content_length: Optional[int] = None, expiration: int = 3600
+) -> PresignedPutPair:
+ accelerated = _get_accelerated_presigned_client()
+ if accelerated:
+ try:
+ params: dict[str, Any] = {"Bucket": settings.OBJECT_STORAGE_BUCKET, "Key": file_key}
+ if content_length is not None:
+ params["ContentLength"] = content_length
+ primary = accelerated.generate_presigned_url(
+ ClientMethod="put_object",
+ Params=params,
+ ExpiresIn=expiration,
+ HttpMethod="PUT",
+ )
+ return PresignedPutPair(
+ primary=primary,
+ fallback=get_presigned_put(file_key=file_key, content_length=content_length, expiration=expiration),
+ )
+ except Exception as e:
+ logger.exception("object_storage.get_accelerated_presigned_put_failed", file_name=file_key, error=e)
+ capture_exception(e)
+ return PresignedPutPair(
+ primary=get_presigned_put(file_key=file_key, content_length=content_length, expiration=expiration),
+ fallback=None,
+ )
+
+
def head_object(file_key: str, bucket: str | None = None) -> Optional[dict]:
return object_storage_client().head_object(file_key=file_key, bucket=bucket or settings.OBJECT_STORAGE_BUCKET)
diff --git a/posthog/storage/test/test_object_storage.py b/posthog/storage/test/test_object_storage.py
index b3bff7072644..7a0e33bffd42 100644
--- a/posthog/storage/test/test_object_storage.py
+++ b/posthog/storage/test/test_object_storage.py
@@ -1,11 +1,13 @@
import re
import uuid
+from urllib.parse import unquote
from posthog.test.base import APIBaseTest
from unittest.mock import MagicMock, patch
from django.test import SimpleTestCase
+import requests
from boto3 import resource
from botocore.client import Config
from botocore.exceptions import ClientError
@@ -24,6 +26,7 @@ from posthog.storage.object_storage import (
UnavailableStorage,
copy_objects,
get_presigned_post,
+ get_presigned_put,
get_presigned_url,
health_check,
is_usable_endpoint,
@@ -112,6 +115,40 @@ class TestStorage(APIBaseTest):
presigned_url["url"],
)
+ def test_can_upload_through_a_presigned_put_url(self) -> None:
+ with self.settings(OBJECT_STORAGE_ENABLED=True):
+ file_name = f"{TEST_BUCKET}/test_can_generate_presigned_put_url/{uuid.uuid4()}"
+
+ presigned_url = get_presigned_put(file_name)
+ assert presigned_url is not None
+ # A PUT addresses the object itself, where a POST addresses the bucket root.
+ assert re.match(rf"^http://localhost:\d+/posthog/{re.escape(file_name)}\?", presigned_url)
+
+ response = requests.put(presigned_url, data=b"my content")
+
+ assert response.status_code == 200, response.text
+ assert read(file_name) == "my content"
+
+ def test_presigned_put_url_rejects_a_body_of_another_length(self) -> None:
+ with self.settings(OBJECT_STORAGE_ENABLED=True):
+ file_name = f"{TEST_BUCKET}/test_presigned_put_signs_length/{uuid.uuid4()}"
+ content = b"my content"
+
+ presigned_url = get_presigned_put(file_name, content_length=len(content))
+ assert presigned_url is not None
+ # A signed `content-length` is the only size condition a presigned PUT can carry, and
+ # it replaces the `content-length-range` a POST policy holds.
+ signed_headers = re.search(r"X-Amz-SignedHeaders=([^&]+)", presigned_url)
+ assert signed_headers is not None
+ assert "content-length" in unquote(signed_headers.group(1)).split(";")
+
+ oversized = requests.put(presigned_url, data=content + b" and more")
+
+ assert oversized.status_code >= 400
+ assert read(file_name, missing_ok=True) is None
+ assert requests.put(presigned_url, data=content).status_code == 200
+ assert read(file_name) == "my content"
+
def test_can_list_objects_with_prefix(self) -> None:
with self.settings(OBJECT_STORAGE_ENABLED=True):
shared_prefix = "a_shared_prefix"
diff --git a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt b/posthog/test/repo_invariants/dataclass_frozen_baseline.txt
index 3ca8380ba94f..f3c2dc895dbb 100644
--- a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt
+++ b/posthog/test/repo_invariants/dataclass_frozen_baseline.txt
@@ -120,7 +120,6 @@
1 products/data_warehouse/backend/logic/webhook_consumer/config.py
1 products/demo/backend/logic/products/hedgebox/matrix.py
1 products/error_tracking/backend/hogql_queries/error_tracking_issue_correlation_query_runner.py
-1 products/error_tracking/backend/logic/symbol_sets.py
1 products/error_tracking/backend/temporal/weekly_digest/test/test_weekly_digest_temporal.py
1 products/experiments/backend/running_time_calculator.py
1 products/experiments/stats/frequentist/method.py
diff --git a/products/error_tracking/backend/logic/symbol_sets.py b/products/error_tracking/backend/logic/symbol_sets.py
index 2607c3497b48..ece66ca7682a 100644
--- a/products/error_tracking/backend/logic/symbol_sets.py
+++ b/products/error_tracking/backend/logic/symbol_sets.py
@@ -9,7 +9,6 @@ the CLI-facing upload contract and are surfaced verbatim by the views.
import hashlib
import datetime
from collections import Counter
-from dataclasses import dataclass
from typing import Any
from django.conf import settings
@@ -21,6 +20,7 @@ import structlog
import posthoganalytics
from rest_framework.exceptions import ValidationError
+from posthog.dataclasses import frozen
from posthog.event_usage import groups
from posthog.models.team.team import Team
from posthog.models.utils import uuid7
@@ -58,11 +58,13 @@ class SymbolSetNotFoundError(Exception):
pass
-@dataclass
+@frozen
class SymbolSetUpload:
chunk_id: str
release_id: str | None
content_hash: str | None
+ # Declaring the byte count earns a presigned PUT signed for exactly that length.
+ content_length: int | None = None
def _extract_failure_code(error_codes: object) -> str | None:
@@ -95,7 +97,7 @@ def generate_symbol_set_file_key() -> str:
return f"{settings.OBJECT_STORAGE_ERROR_TRACKING_SOURCE_MAPS_FOLDER}/{str(uuid7())}"
-def generate_symbol_set_upload_presigned_urls(file_key: str) -> dict[str, Any]:
+def generate_symbol_set_upload_presigned_urls(file_key: str, content_length: int | None = None) -> dict[str, Any]:
pair = object_storage.get_presigned_post_pair(
file_key=file_key,
conditions=[["content-length-range", 0, ONE_HUNDRED_MEGABYTES]],
@@ -107,6 +109,20 @@ def generate_symbol_set_upload_presigned_urls(file_key: str) -> dict[str, Any]:
# transfer-acceleration domain while regular S3 works, so the CLI needs a
# standard-endpoint presigned POST to retry against.
urls["fallback_presigned_url"] = pair.fallback
+
+ if content_length is not None:
+ # Presigned POST is an AWS S3 extension, and a store without it (Cloudflare R2 answers
+ # `501 NotImplemented`) can never receive a symbol set. Every store implements PUT, whose
+ # signed `content-length` stands in for the POST policy's `content-length-range`.
+ put_pair = object_storage.get_presigned_put_pair(
+ file_key=file_key,
+ content_length=content_length,
+ expiration=PRESIGNED_MULTIPLE_UPLOAD_TIMEOUT,
+ )
+ if put_pair.primary is not None:
+ urls["presigned_put_url"] = put_pair.primary
+ if put_pair.fallback is not None:
+ urls["fallback_presigned_put_url"] = put_pair.fallback
return urls
@@ -210,6 +226,19 @@ def _validate_uploads(new_symbol_sets: list[SymbolSetUpload], team: Team) -> Non
detail=f"Unknown release ID provided: {release_id}",
)
+ # Refuse an oversized chunk before the client spends the bandwidth and `bulk_finish_upload`
+ # deletes the row it already created.
+ oversized = sorted(
+ ss.chunk_id
+ for ss in new_symbol_sets
+ if ss.content_length is not None and ss.content_length > ONE_HUNDRED_MEGABYTES
+ )
+ if oversized:
+ raise ValidationError(
+ code="file_too_large",
+ detail=f"Symbol sets larger than 100MB cannot be uploaded: {', '.join(oversized)}",
+ )
+
def _binds_release(existing: ErrorTrackingSymbolSet, upload: SymbolSetUpload) -> bool:
"""Whether the upload binds a release to a symbol set that has none.
@@ -323,7 +352,7 @@ def bulk_create_symbol_sets(
def reissue_upload(existing: ErrorTrackingSymbolSet) -> None:
storage_ptr = generate_symbol_set_file_key()
id_url_map[existing.ref] = {
- **generate_symbol_set_upload_presigned_urls(storage_ptr),
+ **generate_symbol_set_upload_presigned_urls(storage_ptr, new_symbol_set_map[existing.ref].content_length),
"symbol_set_id": str(existing.id),
}
existing.storage_ptr = storage_ptr
@@ -338,7 +367,9 @@ def bulk_create_symbol_sets(
symbol_sets_to_be_created = []
for chunk_id in missing_sets:
storage_ptr = generate_symbol_set_file_key()
- id_url_map[chunk_id] = generate_symbol_set_upload_presigned_urls(storage_ptr)
+ id_url_map[chunk_id] = generate_symbol_set_upload_presigned_urls(
+ storage_ptr, new_symbol_set_map[chunk_id].content_length
+ )
# Note that on creation, we /do not set/ the content hash. We use content hashes included in
# the create request only to see if we can skip updated - we set the content hash when we
# get upload confirmation, during `bulk_finish_upload`, not before
@@ -522,7 +553,9 @@ def bulk_start_upload(
skip_on_conflict: bool,
) -> dict[str, dict[str, Any]]:
uploads = [SymbolSetUpload(**data) for data in symbol_sets]
- uploads.extend([SymbolSetUpload(chunk_id, release_id, None) for chunk_id in chunk_ids])
+ uploads.extend(
+ [SymbolSetUpload(chunk_id=chunk_id, release_id=release_id, content_hash=None) for chunk_id in chunk_ids]
+ )
if not settings.OBJECT_STORAGE_ENABLED:
raise ValidationError(
diff --git a/products/error_tracking/backend/presentation/views/symbol_sets.py b/products/error_tracking/backend/presentation/views/symbol_sets.py
index b884a6c68101..eb2652905627 100644
--- a/products/error_tracking/backend/presentation/views/symbol_sets.py
+++ b/products/error_tracking/backend/presentation/views/symbol_sets.py
@@ -38,6 +38,17 @@ class ErrorTrackingSymbolSetUploadSerializer(serializers.Serializer):
default=None,
help_text="Optional hash of the symbol set content, used to skip unchanged uploads.",
)
+ content_length = serializers.IntegerField(
+ required=False,
+ allow_null=True,
+ default=None,
+ min_value=0,
+ help_text=(
+ "Optional byte count of the content about to be uploaded. When given, the upload "
+ "response also carries a presigned PUT signed for exactly this length, which "
+ "S3-compatible stores without presigned POST support (such as Cloudflare R2) accept."
+ ),
+ )
class ErrorTrackingSymbolSetFinishUploadSerializer(serializers.Serializer):
@@ -124,6 +135,14 @@ class ErrorTrackingSymbolSetBulkStartUploadEntrySerializer(serializers.Serialize
required=False,
help_text="Presigned POST against the standard S3 endpoint, present only when the primary URL uses transfer acceleration. For clients whose network blocks the accelerated endpoint.",
)
+ presigned_put_url = serializers.URLField(
+ required=False,
+ help_text="Presigned PUT for the upload, present only when the request declared `content_length`. Send the raw bytes with a matching `Content-Length` header. Prefer this over `presigned_url`: presigned POST is an AWS extension that some S3-compatible stores reject.",
+ )
+ fallback_presigned_put_url = serializers.URLField(
+ required=False,
+ help_text="Presigned PUT against the standard S3 endpoint, present only when the primary PUT uses transfer acceleration.",
+ )
class ErrorTrackingSymbolSetBulkStartUploadResponseSerializer(serializers.Serializer):
diff --git a/products/error_tracking/backend/tests/api/test_error_tracking_api.py b/products/error_tracking/backend/tests/api/test_error_tracking_api.py
index 655081969843..25dcaa03ac1b 100644
--- a/products/error_tracking/backend/tests/api/test_error_tracking_api.py
+++ b/products/error_tracking/backend/tests/api/test_error_tracking_api.py
@@ -1,6 +1,7 @@
import os
import json
from datetime import UTC, datetime, timedelta
+from urllib.parse import unquote
import time_machine
from posthog.test.base import APIBaseTest
@@ -1466,6 +1467,64 @@ class TestErrorTracking(APIBaseTest):
assert "s3-accelerate" not in entry["fallback_presigned_url"]["url"]
assert entry["fallback_presigned_url"]["fields"]["key"] == symbol_set.storage_ptr
+ def test_bulk_start_upload_omits_presigned_put_without_content_length(self) -> None:
+ chunk_id = str(uuid7())
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/bulk_start_upload",
+ data={"symbol_sets": [{"chunk_id": chunk_id, "content_hash": "hash"}]},
+ )
+
+ entry = response.json()["id_map"][chunk_id]
+ assert "presigned_put_url" not in entry
+ assert entry["presigned_url"]["fields"]["key"] is not None
+
+ def test_bulk_start_upload_signs_presigned_put_for_declared_content_length(self) -> None:
+ chunk_id = str(uuid7())
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/bulk_start_upload",
+ data={"symbol_sets": [{"chunk_id": chunk_id, "content_hash": "hash", "content_length": 1234}]},
+ )
+
+ entry = response.json()["id_map"][chunk_id]
+ symbol_set = ErrorTrackingSymbolSet.objects.get(ref=chunk_id)
+ put_url = entry["presigned_put_url"]
+ # The PUT addresses the object itself, unlike the POST, which addresses the bucket root.
+ assert symbol_set.storage_ptr in put_url
+ # Only a signed content-length stops an oversized body, so it must reach the signature.
+ assert "content-length" in unquote(put_url)
+ assert "fallback_presigned_put_url" not in entry
+ # The POST form stays for clients that predate the PUT.
+ assert entry["presigned_url"]["fields"]["key"] == symbol_set.storage_ptr
+
+ def test_bulk_start_upload_includes_fallback_presigned_put_when_accelerated(self) -> None:
+ chunk_id = str(uuid7())
+ with (
+ self.settings(OBJECT_STORAGE_TRANSFER_ACCELERATION=True),
+ patch("posthog.storage.object_storage._accelerated_presigned_client", None),
+ ):
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/bulk_start_upload",
+ data={"symbol_sets": [{"chunk_id": chunk_id, "content_hash": "hash", "content_length": 10}]},
+ )
+
+ entry = response.json()["id_map"][chunk_id]
+ assert "s3-accelerate" in entry["presigned_put_url"]
+ assert "s3-accelerate" not in entry["fallback_presigned_put_url"]
+
+ def test_bulk_start_upload_rejects_oversized_content_length(self) -> None:
+ chunk_id = str(uuid7())
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/bulk_start_upload",
+ data={
+ "symbol_sets": [{"chunk_id": chunk_id, "content_hash": "hash", "content_length": 100 * 1024 * 1024 + 1}]
+ },
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json()["code"] == "file_too_large"
+ # The row must not exist: a rejected upload leaves nothing for retention to clean up.
+ assert not ErrorTrackingSymbolSet.objects.filter(ref=chunk_id).exists()
+
@patch("products.error_tracking.backend.presentation.views.symbol_sets.posthoganalytics.capture")
def test_bulk_start_upload_skips_uploaded_symbol_sets(self, patched_capture: Mock) -> None:
release = ErrorTrackingRelease.objects.create(
diff --git a/products/error_tracking/frontend/generated/api.schemas.ts b/products/error_tracking/frontend/generated/api.schemas.ts
index 6227d07f4dac..599bb6509533 100644
--- a/products/error_tracking/frontend/generated/api.schemas.ts
+++ b/products/error_tracking/frontend/generated/api.schemas.ts
@@ -2195,6 +2195,12 @@ export interface ErrorTrackingSymbolSetUploadApi {
* @nullable
*/
content_hash?: string | null
+ /**
+ * Optional byte count of the content about to be uploaded. When given, the upload response also carries a presigned PUT signed for exactly this length, which S3-compatible stores without presigned POST support (such as Cloudflare R2) accept.
+ * @minimum 0
+ * @nullable
+ */
+ content_length?: number | null
}
export interface ErrorTrackingSymbolSetBulkCheckUploadApi {
@@ -2261,6 +2267,10 @@ export interface ErrorTrackingSymbolSetBulkStartUploadEntryApi {
presigned_url: ErrorTrackingSymbolSetPresignedPostApi
/** Presigned POST against the standard S3 endpoint, present only when the primary URL uses transfer acceleration. For clients whose network blocks the accelerated endpoint. */
fallback_presigned_url?: ErrorTrackingSymbolSetPresignedPostApi
+ /** Presigned PUT for the upload, present only when the request declared `content_length`. Send the raw bytes with a matching `Content-Length` header. Prefer this over `presigned_url`: presigned POST is an AWS extension that some S3-compatible stores reject. */
+ presigned_put_url?: string
+ /** Presigned PUT against the standard S3 endpoint, present only when the primary PUT uses transfer acceleration. */
+ fallback_presigned_put_url?: string
}
/**
diff --git a/products/error_tracking/frontend/generated/api.zod.ts b/products/error_tracking/frontend/generated/api.zod.ts
index dda1826e833a..69c45b4e26e7 100644
--- a/products/error_tracking/frontend/generated/api.zod.ts
+++ b/products/error_tracking/frontend/generated/api.zod.ts
@@ -1256,6 +1256,8 @@ export const ErrorTrackingSymbolSetsFinishUploadUpdateBody = /* @__PURE__ */ zod
/**
* Report which of the given symbol sets still need `bulk_start_upload`. Symbol sets already uploaded with identical content are omitted and marked as still in use.
*/
+export const errorTrackingSymbolSetsBulkCheckUploadCreateBodySymbolSetsItemContentLengthMin = 0
+
export const errorTrackingSymbolSetsBulkCheckUploadCreateBodyForceDefault = false
export const errorTrackingSymbolSetsBulkCheckUploadCreateBodySkipOnConflictDefault = false
@@ -1272,6 +1274,13 @@ export const ErrorTrackingSymbolSetsBulkCheckUploadCreateBody = /* @__PURE__ */
.string()
.nullish()
.describe('Optional hash of the symbol set content, used to skip unchanged uploads.'),
+ content_length: zod
+ .number()
+ .min(errorTrackingSymbolSetsBulkCheckUploadCreateBodySymbolSetsItemContentLengthMin)
+ .nullish()
+ .describe(
+ 'Optional byte count of the content about to be uploaded. When given, the upload response also carries a presigned PUT signed for exactly this length, which S3-compatible stores without presigned POST support (such as Cloudflare R2) accept.'
+ ),
})
)
.describe(
@@ -1295,6 +1304,8 @@ export const ErrorTrackingSymbolSetsBulkFinishUploadCreateBody = /* @__PURE__ */
content_hashes: zod.record(zod.string(), zod.string()).describe('Map of symbol set ID to uploaded content hash.'),
})
+export const errorTrackingSymbolSetsBulkStartUploadCreateBodySymbolSetsItemContentLengthMin = 0
+
export const errorTrackingSymbolSetsBulkStartUploadCreateBodyForceDefault = false
export const errorTrackingSymbolSetsBulkStartUploadCreateBodySkipOnConflictDefault = false
@@ -1311,6 +1322,13 @@ export const ErrorTrackingSymbolSetsBulkStartUploadCreateBody = /* @__PURE__ */
.string()
.nullish()
.describe('Optional hash of the symbol set content, used to skip unchanged uploads.'),
+ content_length: zod
+ .number()
+ .min(errorTrackingSymbolSetsBulkStartUploadCreateBodySymbolSetsItemContentLengthMin)
+ .nullish()
+ .describe(
+ 'Optional byte count of the content about to be uploaded. When given, the upload response also carries a presigned PUT signed for exactly this length, which S3-compatible stores without presigned POST support (such as Cloudflare R2) accept.'
+ ),
})
)
.optional()
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index e9a15809d1d8..a16b00be26ad 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -38209,6 +38209,12 @@ export namespace Schemas {
* @nullable
*/
content_hash?: string | null;
+ /**
+ * Optional byte count of the content about to be uploaded. When given, the upload response also carries a presigned PUT signed for exactly this length, which S3-compatible stores without presigned POST support (such as Cloudflare R2) accept.
+ * @minimum 0
+ * @nullable
+ */
+ content_length?: number | null;
}
export interface ErrorTrackingSymbolSetBulkCheckUpload {
@@ -38275,6 +38281,10 @@ export namespace Schemas {
presigned_url: ErrorTrackingSymbolSetPresignedPost;
/** Presigned POST against the standard S3 endpoint, present only when the primary URL uses transfer acceleration. For clients whose network blocks the accelerated endpoint. */
fallback_presigned_url?: ErrorTrackingSymbolSetPresignedPost;
+ /** Presigned PUT for the upload, present only when the request declared `content_length`. Send the raw bytes with a matching `Content-Length` header. Prefer this over `presigned_url`: presigned POST is an AWS extension that some S3-compatible stores reject. */
+ presigned_put_url?: string;
+ /** Presigned PUT against the standard S3 endpoint, present only when the primary PUT uses transfer acceleration. */
+ fallback_presigned_put_url?: string;
}
/**