Skip to main content
Applies to:
  • Plan:
  • Deployment:

Summary

Issue: Opening a large trace in the UI returns a Failed to fetch error and the full raw trace does not load. Cause: When a BTQL query result exceeds ~4MB, the API stores the result temporarily in the bt-production-lambda-responses S3 bucket and redirects the browser to fetch it via a presigned URL. This cross-origin redirect causes the browser to send Origin: null, which the S3 bucket’s CORS policy does not allow. Resolution: Update the CORS configuration on the bt-production-lambda-responses bucket to allow * as an origin.

Resolution steps

Diagnose the CORS issue

Step 1: Check the network request origin

Open your browser’s Network tab, find the failing S3 GET request, and inspect the request headers. If you see Origin: null (not Origin: https://www.braintrust.dev), the cross-origin redirect is causing the CORS block.

Step 2: Verify the bucket’s CORS configuration

aws s3api get-bucket-cors --bucket <your-bt-production-lambda-responses-bucket>
If https://www.braintrust.dev is listed in AllowedOrigins but null is not, the existing config does not cover the redirect case.

Fix the CORS configuration

Step 1: Update Terraform

Change s3_additional_allowed_origins to allow all origins:
s3_additional_allowed_origins = ["*"]

Step 2: Apply the change

terraform apply
This updates the CORS policy on the bt-production-lambda-responses bucket to allow browser fetches from redirected presigned URLs.

Additional context

  • The bt-production-lambda-responses bucket holds ephemeral overflow files only — BTQL query result overflows and SDK log upload overflows. It does not store primary trace data.
  • Every time a trace is opened in the UI, a fresh BTQL query runs and a new presigned URL is generated if the result exceeds ~4MB. Fixing CORS resolves the error for all traces, including previously affected ones.