使用MTS API创建TileSet源时遭遇请求实体过大错误的咨询
Troubleshooting "request entity too large" with Mapbox Tiling Service (MTS) Source Uploads
Great question—this is a super common gotcha with Mapbox's MTS API, even though the docs state the total source size limit is 20GB. Here's why you're hitting this error and how to fix it:
Key Reasons for the Error
- Single HTTP Request Size Limits: While the total allowed size for a tileset source is 20GB, the direct
POSTendpoint you’re using has a much smaller cap on single request body sizes (often around 100MB, though your 66MB file might be hitting a stricter gateway limit or rounding up due to encoding overhead). Mapbox expects large files to use their resumable upload flow instead of sending the entire file in one go. - Client/Proxy Restrictions: Your HTTP client (like curl, axios, or Postman) or a network proxy (e.g., corporate firewall) might enforce its own maximum request size that’s smaller than 66MB.
- Incorrect Endpoint Usage: The endpoint you’re calling is optimized for small file uploads. Large files require using Mapbox’s dedicated resumable upload endpoints.
How to Fix It
Switch to Mapbox's resumable upload process—it’s built specifically for large files and avoids single-request size limits. Here’s a quick breakdown of the steps:
- Initialize the resumable upload: Send a POST request to the resumable endpoint to get an upload ID and pre-signed URLs for file chunks.
curl -X POST "https://api.mapbox.com/tilesets/v1/sources/your-username/your-source-name/resumable?access_token=your-access-token" \ -H "Content-Type: application/json" \ -d '{"fileSize": 68157440}' # Replace with your file's exact byte size (66MB ≈ 68157440 bytes) - Upload your file in chunks: Use the pre-signed URLs returned in step 1 to upload your GeoJSON file in smaller chunks (Mapbox recommends 5MB–10MB chunks for reliability).
- Finalize the upload: Once all chunks are uploaded, send a POST request to confirm completion and create the tileset source.
Additionally, double-check:
- Your HTTP client settings (e.g., disable any
max-filesizelimits in curl, or adjust configs in axios/fetch). - Your network environment—try testing from a personal network if you’re behind a corporate proxy to rule out proxy-side restrictions.
内容的提问来源于stack exchange,提问作者Yatish
相关产品推荐
相关产品推荐

